struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Struts 1 migrate to Struts 2 question
Date Wed, 23 Dec 2015 13:13:21 GMT



> Date: Tue, 22 Dec 2015 20:38:47 -0500
> Subject: Re: Struts 1 migrate to Struts 2 question
> From: davelnewton@gmail.com
> To: user@struts.apache.org
> 
> >
> > The effort required to upgrade and test a large application to Struts
> > version 2 looks very large.  The effort to upgrade and test the entire
> > application in a single release looks undoable.
> >
> 
> Agreed.
> 
> 
> > 1)      Are there any software tools that can be used to speed up the time
> > to update JSPs, page validation, tag library calls, Action classes, etc to
> > reduce development, improve code quality, and reduce testing time?
> >
> 
> None that I'm aware of.
> 
> 
> > 2)      Can a single application use both Struts 1 and Struts 2 at the
> > same time?
> >
> 
> Yes.
> 
> 
> > a.       Would it be feasible to use Struts 2 for any new pages and
> > upgrade to Struts 2 for any pages being changed for other reasons?
> >
> 
> Yes.
> 
> 
> > 3)      We do an application release every 6 weeks or so.  We can't do
> > this in one release unless we find or develop a tool to help us convert
> > pages to Struts 2.  We are considering upgrading 100 pages per release to
> > Struts 2.  Has anyone done something like this successfully?  What are best
> > practices and lessons learned?
> >
> 
> That strikes me as a fairly aggressive timeline, obviously it depends on
> the pages and functionality.
> 
> There are zero similarities between S1 and S2. If your S1 app was
> well-architected the effort will be confined to the view and controller
> layers, at least, but even that is non-trivial.
> 
> 4)      Test effort.  With all of the code changes required it seems that
> > developers could miss things.
> >
> 
> If you have no integration tests, then yes, this will be fraught with
> potential issues. Again, a well-architected S1 app is in less danger since
> the important business logic is already isolated and Struts acts only as a
> mediation layer between the client (e.g., the browser or API users) and the
> business logic.
> 
> The ultimate answer(s) really depends on the nature of your app. If the JSP
> pages are simple it might be possible to write a small conversion tool that
> does a rough translation between tag libraries; beyond that... it'll be
> mostly manual labor.
> 
> Dave

MG>Dave is right
MG>the Struts2 wrapper for existing Struts1 Actions and Struts1 Action Forms is called
"struts-1-plugin"
MG>To use existing Struts1 Actions and ActionForms into a Struts2 Application, create a
normal Struts2 configuration package in struts.xml but MG>have it extend struts1-default.
Struts1-default paclage contains interceptors and a default interceptor stack that work this
plugin INTO the MG>Struts2 request process
MG>the interceptor-ref interceptor named struts1-default is the interceptor that manages
the creation and scope of your ActionForm:<action name="myFormAction" class="org.apache.struts2.s1.Struts1Action">
 <param name="className">com.mycompany.myapp.MyAction</param>   <interceptor-ref
name="scopedModelDriven">    <param name="className">com.mycompany.myapp.MyForm</param>
   <param name="name">gangsterForm</param>    <param name="scope">session</param>
 </interceptor-ref>  <interceptor-ref name="struts1-default"/>   <result>myAction.jsp</result></action>MG>struts1-default
package itself is declared in src/main/resources/struts-plugin.xml (inside the plugin) the
declaration should start with:
MG><struts>MG>    <package name="struts1-default" extends="struts-default">MG>Doc
available at:MG>https://struts.apache.org/docs/struts-1-plugin.html
MG>be sure to copy struts2-struts1-plugin*.jar to /WEB-INF/lib and copy struts1*.jar to
WEB-INF/lib before restarting webapp
> 
> -- 
> e: davelnewton@gmail.com
> m: 908-380-8699
> s: davelnewton_skype
> t: @dave_newton <https://twitter.com/dave_newton>
> b: Bucky Bits <http://buckybits.blogspot.com/>
> g: davelnewton <https://github.com/davelnewton>
> so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message