RE: Struts upgrade issue

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Struts upgrade issue

Gopal, Siva Prakash (US - Mechanicsburg)
Hi All,

We have issue after upgrade to struts2-core-2.3.32 version

Action Method :

private List<ListOfValue> radioValueNum=new ArrayList<ListOfValue>();

                public List<ListOfValue> getRadioValueNum() {
                                if(!radioValueNum.isEmpty()){
                                                radioValueNum.clear();
                                                radioValueNum.add(new ListOfValue("1", getText("generic.yes")));
                                                radioValueNum.add(new ListOfValue("2", getText("generic.no")));
                                }
                                else{
                                                radioValueNum.add(new ListOfValue("1", getText("generic.yes")));
                                                radioValueNum.add(new ListOfValue("2", getText("generic.no")));
                                }
                                return radioValueNum;
                }

JSP :

<s:radio id="radio1" name="individualVO.pren" label="radio1"
                                   list="radioValueNum" listKey="id" listValue="name"
                                    onclick="javascript:handleRadioChange();" />

Generated HTML before strus upgrade 32 version (struts2-core-2.3.20.jar):
                 <input name="individualVO.pregnancyQuestion" value="1" id="radio11" onclick="javascript:handleRadioChange();" type="radio">
                <label for="radio11" onclick="javascript:handleRadioChange();">Yes</label>
                <input name="individualVO.pregnancyQuestion" checked="checked" value="2" id="radio12" onclick="javascript:handleRadioChange();" type="radio">
                <label for="radio12" onclick="javascript:handleRadioChange();">No</label>


Generated HTML after strus upgrade 32 version (struts2-core-2.3.32.jar):

                <input name="individualVO.pregnancyQuestion" value="1" id="radio10" onclick="javascript:handleRadioChange();" type="radio">
                <label for="radio10" onclick="javascript:handleRadioChange();">Yes</label>
                <input name="individualVO.pregnancyQuestion" checked="checked" value="2" id="radio11" onclick="javascript:handleRadioChange();" type="radio">
                <label for="radio11" onclick="javascript:handleRadioChange();">No</label>

Here we have issue with ID generation for radio button .

Before upgrade, id's for radio button has been generated as id="radio11" and id="radio12" [by appending id="radio1"+key value mentioned in the list (radioValueNum).

After upgrade, id's for radio button has been generated as id="radio10" and id="radio11". it looks like key value mentioned in the list is not appended (index position is getting appended)

We just want to cross check that we are missing any jars as part of upgrade. or it caused due to ognl jar fix.

Please guide us.

This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and any disclosure, copying, or distribution of this message, or the taking of any action based on it, by you is strictly prohibited.

v.E.1
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RE: Struts upgrade issue

Gopal, Siva Prakash (US - Mechanicsburg)
Hi All,


we have identified issues between radio button generation under RadioHandler.java under struts2-javatemplates-plugin-2.3.20 and struts2-javatemplates-plugin-2.3.32

struts2-javatemplates-plugin-2.3.20
------------------------------------------------
for(Iterator itt = MakeIterator.convert(listObj); itt.hasNext(); stack.pop())
{
Object item = itt.next();
stack.push(item);
Object itemKey = findValue(listKey == null ? "top" : listKey);
String itemKeyStr = StringUtils.defaultString(itemKey != null ? itemKey.toString() : null);
Object itemValue = findValue(listValue == null ? "top" : listValue);
String itemValueStr = StringUtils.defaultString(itemValue != null ? itemValue.toString() : null);
String id = (new StringBuilder()).append(params.get("id")).append(itemKeyStr).toString();
Here id is generated by appending with key value

struts2-javatemplates-plugin-2.3.32
-------------------------------------------------
for(Iterator itt = MakeIterator.convert(listObj); itt.hasNext(); stack.pop())
{
Object item = itt.next();
stack.push(item);
Object itemKey = findValue(listKey == null ? "top" : listKey);
String itemKeyStr = StringUtils.defaultString(itemKey != null ? itemKey.toString() : null);
Object itemValue = findValue(listValue == null ? "top" : listValue);
String itemValueStr = StringUtils.defaultString(itemValue != null ? itemValue.toString() : null);
String id = (new StringBuilder()).append(params.get("id")).append(Integer.toString(cnt++)).toString();
Here id is generated by appending with count of list items

Because of these changes, we need to modify the jsp/javascription function in all our application.

if we are not upgrading to next struts 2.3.20 (using struts2-javatemplates-plugin-2.3.20 along with strut2-cord 2.3.32 version)

we are getting below error

Caused by: java.lang.NoSuchMethodError: org/apache/struts2/util/ComponentUtils.isExpression(Ljava/lang/Object;)Z
at org.apache.struts2.views.java.simple.DynamicAttributesHandler.processDynamicAttributes(DynamicAttributesHandler.java:48)
at org.apache.struts2.views.java.simple.DynamicAttributesHandler.start(DynamicAttributesHandler.java:41)

Do we have any alternate option to resolve this issue


Thanks,
Siva

This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and any disclosure, copying, or distribution of this message, or the taking of any action based on it, by you is strictly prohibited.

v.E.1
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RE: Struts upgrade issue

Christoph Nenning
Hi,

for cases like yours a new librariy has been created: "Struts 2 Secure
Jakarta Multipart parser plugin".

With that you can fix recent security issue in your app with your current
version of struts. That buys you more time to do migration or refactoring
necessary to upgrade struts.


http://struts.apache.org/download.cgi#struts-extras

https://github.com/apache/struts-extras



Regards,
Christoph



> From: "Gopal, Siva Prakash (US - Mechanicsburg)" <[hidden email]>
> To: "[hidden email]" <[hidden email]>,
> Date: 24.03.2017 04:49
> Subject: Re: RE: Struts upgrade issue
>
> Hi All,
>
>
> we have identified issues between radio button generation under
> RadioHandler.java under struts2-javatemplates-plugin-2.3.20 and
> struts2-javatemplates-plugin-2.3.32
>
> struts2-javatemplates-plugin-2.3.20
> ------------------------------------------------
> for(Iterator itt = MakeIterator.convert(listObj); itt.hasNext();
stack.pop())

> {
> Object item = itt.next();
> stack.push(item);
> Object itemKey = findValue(listKey == null ? "top" : listKey);
> String itemKeyStr = StringUtils.defaultString(itemKey != null ?
> itemKey.toString() : null);
> Object itemValue = findValue(listValue == null ? "top" : listValue);
> String itemValueStr = StringUtils.defaultString(itemValue != null ?
> itemValue.toString() : null);
> String id = (new StringBuilder()).append(params.get("id")).append
> (itemKeyStr).toString();
> Here id is generated by appending with key value
>
> struts2-javatemplates-plugin-2.3.32
> -------------------------------------------------
> for(Iterator itt = MakeIterator.convert(listObj); itt.hasNext();
stack.pop())

> {
> Object item = itt.next();
> stack.push(item);
> Object itemKey = findValue(listKey == null ? "top" : listKey);
> String itemKeyStr = StringUtils.defaultString(itemKey != null ?
> itemKey.toString() : null);
> Object itemValue = findValue(listValue == null ? "top" : listValue);
> String itemValueStr = StringUtils.defaultString(itemValue != null ?
> itemValue.toString() : null);
> String id = (new StringBuilder()).append(params.get("id")).append
> (Integer.toString(cnt++)).toString();
> Here id is generated by appending with count of list items
>
> Because of these changes, we need to modify the jsp/javascription
> function in all our application.
>
> if we are not upgrading to next struts 2.3.20 (using struts2-
> javatemplates-plugin-2.3.20 along with strut2-cord 2.3.32 version)
>
> we are getting below error
>
> Caused by: java.lang.NoSuchMethodError: org/apache/struts2/util/
> ComponentUtils.isExpression(Ljava/lang/Object;)Z
> at
>
org.apache.struts2.views.java.simple.DynamicAttributesHandler.processDynamicAttributes

> (DynamicAttributesHandler.java:48)
> at
> org.apache.struts2.views.java.simple.DynamicAttributesHandler.start
> (DynamicAttributesHandler.java:41)
>
> Do we have any alternate option to resolve this issue
>
>
> Thanks,
> Siva
>
> This message (including any attachments) contains confidential
> information intended for a specific individual and purpose, and is
> protected by law. If you are not the intended recipient, you should
> delete this message and any disclosure, copying, or distribution of
> this message, or the taking of any action based on it, by you is
> strictly prohibited.
>
> v.E.1

This Email was scanned by Sophos Anti Virus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RE: Struts upgrade issue

Lukasz Lenart
In reply to this post by Gopal, Siva Prakash (US - Mechanicsburg)
2017-03-24 4:47 GMT+01:00 Gopal, Siva Prakash (US - Mechanicsburg)
<[hidden email]>:

> Hi All,
>
>
> we have identified issues between radio button generation under RadioHandler.java under struts2-javatemplates-plugin-2.3.20 and struts2-javatemplates-plugin-2.3.32
>
> struts2-javatemplates-plugin-2.3.20
> ------------------------------------------------
> for(Iterator itt = MakeIterator.convert(listObj); itt.hasNext(); stack.pop())
> {
> Object item = itt.next();
> stack.push(item);
> Object itemKey = findValue(listKey == null ? "top" : listKey);
> String itemKeyStr = StringUtils.defaultString(itemKey != null ? itemKey.toString() : null);
> Object itemValue = findValue(listValue == null ? "top" : listValue);
> String itemValueStr = StringUtils.defaultString(itemValue != null ? itemValue.toString() : null);
> String id = (new StringBuilder()).append(params.get("id")).append(itemKeyStr).toString();
> Here id is generated by appending with key value
>
> struts2-javatemplates-plugin-2.3.32
> -------------------------------------------------
> for(Iterator itt = MakeIterator.convert(listObj); itt.hasNext(); stack.pop())
> {
> Object item = itt.next();
> stack.push(item);
> Object itemKey = findValue(listKey == null ? "top" : listKey);
> String itemKeyStr = StringUtils.defaultString(itemKey != null ? itemKey.toString() : null);
> Object itemValue = findValue(listValue == null ? "top" : listValue);
> String itemValueStr = StringUtils.defaultString(itemValue != null ? itemValue.toString() : null);
> String id = (new StringBuilder()).append(params.get("id")).append(Integer.toString(cnt++)).toString();
> Here id is generated by appending with count of list items
>
> Because of these changes, we need to modify the jsp/javascription function in all our application.

I cannot find such code in the RadioHandler.java

https://github.com/apache/struts/blob/support-2-3/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/RadioHandler.java#L45-L92

> if we are not upgrading to next struts 2.3.20 (using struts2-javatemplates-plugin-2.3.20 along with strut2-cord 2.3.32 version)
>
> we are getting below error
>
> Caused by: java.lang.NoSuchMethodError: org/apache/struts2/util/ComponentUtils.isExpression(Ljava/lang/Object;)Z
> at org.apache.struts2.views.java.simple.DynamicAttributesHandler.processDynamicAttributes(DynamicAttributesHandler.java:48)
> at org.apache.struts2.views.java.simple.DynamicAttributesHandler.start(DynamicAttributesHandler.java:41)

You cannot mix different versions

> Do we have any alternate option to resolve this issue

Not yet as I cannot identify the source code.



Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: RE: Struts upgrade issue

Gopal, Siva Prakash (US - Mechanicsburg)
I have decompiled class file and looked on the logic's

RadioHandler.java --> generate() method.

Thanks,
Siva

-----Original Message-----
From: Lukasz Lenart [mailto:[hidden email]]
Sent: Friday, March 24, 2017 4:17 AM
To: Struts Users Mailing List <[hidden email]>
Subject: Re: RE: Struts upgrade issue

2017-03-24 4:47 GMT+01:00 Gopal, Siva Prakash (US - Mechanicsburg)
<[hidden email]>:

> Hi All,
>
>
> we have identified issues between radio button generation under RadioHandler.java under struts2-javatemplates-plugin-2.3.20 and struts2-javatemplates-plugin-2.3.32
>
> struts2-javatemplates-plugin-2.3.20
> ------------------------------------------------
> for(Iterator itt = MakeIterator.convert(listObj); itt.hasNext(); stack.pop())
> {
> Object item = itt.next();
> stack.push(item);
> Object itemKey = findValue(listKey == null ? "top" : listKey);
> String itemKeyStr = StringUtils.defaultString(itemKey != null ? itemKey.toString() : null);
> Object itemValue = findValue(listValue == null ? "top" : listValue);
> String itemValueStr = StringUtils.defaultString(itemValue != null ? itemValue.toString() : null);
> String id = (new StringBuilder()).append(params.get("id")).append(itemKeyStr).toString();
> Here id is generated by appending with key value
>
> struts2-javatemplates-plugin-2.3.32
> -------------------------------------------------
> for(Iterator itt = MakeIterator.convert(listObj); itt.hasNext(); stack.pop())
> {
> Object item = itt.next();
> stack.push(item);
> Object itemKey = findValue(listKey == null ? "top" : listKey);
> String itemKeyStr = StringUtils.defaultString(itemKey != null ? itemKey.toString() : null);
> Object itemValue = findValue(listValue == null ? "top" : listValue);
> String itemValueStr = StringUtils.defaultString(itemValue != null ? itemValue.toString() : null);
> String id = (new StringBuilder()).append(params.get("id")).append(Integer.toString(cnt++)).toString();
> Here id is generated by appending with count of list items
>
> Because of these changes, we need to modify the jsp/javascription function in all our application.

I cannot find such code in the RadioHandler.java

https://github.com/apache/struts/blob/support-2-3/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/RadioHandler.java#L45-L92

> if we are not upgrading to next struts 2.3.20 (using struts2-javatemplates-plugin-2.3.20 along with strut2-cord 2.3.32 version)
>
> we are getting below error
>
> Caused by: java.lang.NoSuchMethodError: org/apache/struts2/util/ComponentUtils.isExpression(Ljava/lang/Object;)Z
> at org.apache.struts2.views.java.simple.DynamicAttributesHandler.processDynamicAttributes(DynamicAttributesHandler.java:48)
> at org.apache.struts2.views.java.simple.DynamicAttributesHandler.start(DynamicAttributesHandler.java:41)

You cannot mix different versions

> Do we have any alternate option to resolve this issue

Not yet as I cannot identify the source code.



Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and any disclosure, copying, or distribution of this message, or the taking of any action based on it, by you is strictly prohibited.

v.E.1

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RE: Struts upgrade issue

Lukasz Lenart
2017-03-24 14:12 GMT+01:00 Gopal, Siva Prakash (US - Mechanicsburg)
<[hidden email]>:
> I have decompiled class file and looked on the logic's
>
> RadioHandler.java --> generate() method.

Hm... but the incremental ID was introduced in Struts 2.2.3, long time ago
https://issues.apache.org/jira/browse/WW-3587


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...