• Post Reply Bookmark Topic Watch Topic
  • New Topic

Facing issues when upgrading Struts from version 2.0.11.2 to 2.3.28.1

 
Naveen Naik
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application which is using Struts 2.0.11.2.The application is flagged as vulnerable due to the old version of struts.I am facing issues while upgrading the struts to version 2.3.28.1(this is the latest allowed version in our organization). After a lot of research on google i understood that the Dojo classes are deprecated in the new struts version. However our project uses a lot of dojo tags. I am aware of the alternative plugins such as Struts Jquery. But use of alternative plugins will involve a lot of code change and testing which is not feasible in the current time frame we have got. Is there some way out to use the dojo tags with the struts to version 2.3.28.1?. Can we somehow incorporate the struts2-dojo-plugin with the Struts version 2.3.28.1?.

i tried it myself but am getting stuck(details mentioned below)

What i tried:

1) I replaced the Struts core jar with struts2-core-2.3.28.1 jar.

2) Updated all the dependency jars as mentioned in the Maven repository.

3) Added struts2-dojo-plugin-2.3.28.1

4) Included in JSP-s

<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<head><sx:head /></head>
The issue i am facing:

When i hit the JSP below is the error i get. Any help is highly appreciated.Let me know if you need any more details or information from my side.

 
Joe Ess
Bartender
Posts: 9372
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please let us know if you post the same question elsewhere.  We don't want do duplicate effort if the other forum has already solved the issue.

Naveen Naik wrote: i understood that the Dojo classes are deprecated in the new struts version.


The Dojo plugin has been deprecated since version 2.1 (around January, 2009).
I see you posted on the other site that you were using JAR files from different versions of Struts at one time. Have a look at this FAQ entry for advice on how to manage dependencies (though if you're using Maven, that should be taken care of for you)  Can you detail all the JAR files you are using? 
 
Naveen Naik
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,

Thanks for your reply. yes i have posted the question on the other forum as well.Apologies if this is not expected. i have very less time frame and i didn't know that both the forums have same volunteers answering the questions.
However i have still not got the answer to my question i.e  is there a way or a workaround to use Dojo tags with struts version 2.3.28.1?
Also as requested below is the list of jars present in my webinf /lib.

 
Joe Ess
Bartender
Posts: 9372
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naveen Naik wrote: i have posted the question on the other forum as well.Apologies if this is not expected. i have very less time frame and i didn't know that both the forums have same volunteers answering the questions.


No worries.  We just don't want to duplicate effort. 
I looked at the dependencies and I don't see any obvious conflicts.  It looks like you are missing the log4j-api and log4j-core libraries, but I don't think that would cause the issue you are seeing.  The classes in the servlet-api JAR are probably provided by your server at runtime so you probably don't need to package that (you may need it to compile).
Poking around the Struts issue tracker, it looks like Dojo may be broken in IE 11.  You may want to experiment with different browsers.
Unfortunately, I don't have any experience with Dojo.  We have always used JQuery.  If I were in your position, I would start with a fresh Struts projects and create some simple demos of Dojo functionality to verify that it works at all.  Once verifying that, I would build it up to duplicate the parts of the application you are having a problem with.  If the Dojo plugin still works, you should be able to isolate the issue you posted above and resolve or work around it.  If the Dojo plugin does not work, you can ask your management to weigh the cost of a having a vulnerable application with the cost of changing it out with JQuery (or whatever other technology you choose).
One other factor to consider is the fact that the Dojo plugin is no longer distributed with Struts, going forward with version 2.5.  If your organization plans to keep current with security updates, they will eventually have to migrate from Dojo.
 
Naveen Naik
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks joe for your replay and effort. I do have one question now. Are the dojo plugin with the Struts jar and dojo toolkitwebpage same?.
 
Joe Ess
Bartender
Posts: 9372
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think so. It was deprecated in 2009, and this post from 2009 by David Newton (a Struts committer at the time) says it is "a very old version". 
 
Naveen Naik
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,

Thanks for your reply. As suggested, i tried to replace the dojo plugin with struts2-jquery-plugin-3.3.0. I replaced the tags in jsp files with the jquery tags which are making Ajax calls . The issue now i am facing is there are two javascript files which are using dojo components which are as follows.

var freeFormWidget=dojo.widget.byId("viewMsgTab"); and

dojo.event.topic.publish("/viewReqMsg_topic",templateName);

The impact of this is the jsp page is loaded with the tabbed panels but its not showing any contents.

I searched but could not find any replacement in jquery. Can you help me on how to replace these dojo components in the javascript file?

 
Joe Ess
Bartender
Posts: 9372
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have any experience with Dojo.  jQuery supports tabbed panels.  Click here, click on the "Widgets" link on that page and click on "Tabs".  There's a couple of examples there.
 
Naveen Naik
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to update. I resolved this by removing all the dojo tags and using JQuery instead of dojo. It was a good idea to use JQuery as it will help for any future Struts update. Following are the links which may be helpful for dojo to jquery conversion.
https://github.com/struts-community-plugins/struts2-jquery/wiki

Thanks everyone for all you help and inputs.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!