Difference Betwixt Struts I As Well As Struts Ii Spider Web Evolution Framework
I had operate previously on Struts 1 but never touched Struts 2, peculiarly since Spring MVC was at that topographic point to convey the leading role. Recently i of my friend enquire me to help amongst Struts2, which leads me to await on Struts2 framework from start. First affair I wanted to detect out differences betwixt Struts 1 in addition to Struts 2 framework, because inwards my experience, if you lot withdraw maintain worked inwards previous version looking differences betwixt 2 versions of Struts tin rapidly help to find, what changes in addition to What are the novel features, concepts in addition to improvement is offered past times Struts 2. Also difference betwixt Struts 1 in addition to Struts 2 is a skilful candidate to include in my listing of Struts interview question for quick revision. To my surprise, Struts 2 seems to last completely unlike than Struts 1 framework, because roughly of the almost familiar materials similar ActionForm, struts-config.xml, in addition to Action classes are changed inwards Struts 2 framework. Struts 2 has every bit good done skilful project on removing straight dependency of Action classes on Servlet API e.g. HttpServletRequest in addition to HttpServletResponse, which makes testing slowly past times using Dependency Injection concept. In this article, nosotros volition roughly of import differences betwixt Struts 1 in addition to Struts 2 framework.
Struts 1 vs Struts 2 - Differences
Here is my listing of roughly mutual divergence betwixt Struts 1 in addition to Struts 2 framework. This listing contains roughly observations, which tin every bit good help you lot to approximate roughly major changes inwards struts 2 from struts 1.
1) First major divergence betwixt Jakarta Struts 1 in addition to Struts 2 framework is inwards Action flat itself. In Struts 1 it's mandatory to extend org.apache.struts.action.Action and implement execute() method which returns ActionForward in addition to convey HttpServletRequest in addition to HttpServletResponse. This is non the illustration amongst Struts 2, hither Action flat tin last a unproblematic POJO or Java object amongst execute() method. Also execute() method returns String rather than returning ActionForward object. You tin nevertheless utilisation ActionSupport flat or Action interface but those are completely optional.
2) Second primary divergence betwixt Struts 1 in addition to Struts 2 is on configuration files, before nosotros used to configure Struts using struts-config.xml, but amongst Struts 2 you lot tin utilisation multiple configuration file, almost normally used every bit struts.xml. What is to a greater extent than of import is annunciation of Struts 2 Filter in web.xml e.g.
<filter>
<filter-name>struts2Fitler</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2Fitler</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Also, if you lot notice, instead of mapping this to *.do or *.action nosotros withdraw maintain mapped it amongst *, which agency all url blueprint volition last flown to struts2 filter.
3) One to a greater extent than divergence I noticed betwixt Struts 1 in addition to Struts 2 is on Front goal Controller. In Struts 1, ActionServlet is considered every bit FrontController piece inwards Struts 2 its Filter, which tin last considered every bit front end goal controller.
4) Another useful enhancement inwards Struts2 is Interceptor API, which allows to practice lot of materials much easily e.g. file upload using Struts2's builtin FileUploadInterceptor class.
5) One to a greater extent than divergence betwixt Struts 1 in addition to Struts 2 which I similar is removing dependency of Action classes to Servlet API inwards cast of HttpServletRequest in addition to HttpServletResponse classes required inwards execute() method. Struts 2 don't withdraw maintain such dependency in addition to its execute() method doesn't required Servlet API.
There are lot to a greater extent than divergence inwards Struts 1 in addition to Struts 2 in addition to I propose going thorough Struts 2 documentation every bit you lot larn Struts 2. To me, Struts 2 looks completely unlike than Struts 1. Since I am using Spring MVC to a greater extent than frequently, I nevertheless demand to explore Struts 2 to a greater extent than closely. I volition proceed this listing of differences betwixt Struts 1 in addition to Struts 2 updated every bit in addition to when I establish roughly to a greater extent than differences.
Further Learning
How to configure LDAP authentication amongst Windows Active Directory using Spring Security
0 Response to "Difference Betwixt Struts I As Well As Struts Ii Spider Web Evolution Framework"
Post a Comment