Академический Документы
Профессиональный Документы
Культура Документы
Javarevisited
Blog about Java Program Tutorial Example How to, Unix Linux commands, Interview Questions, FIX Protocol, Tibco RV tutorials, Equities trading system, MySQL
Ads by Google
Struts
Java Tutorial
Searc h
HttpServletResponse, which makes testing easy by using Dependency Injection concept. In this article, we will some
important differences between Struts 1 and Struts 2 framework.
1) First major difference between Jakarta Struts 1 and Struts 2 framework is in Actionclass itself. In Struts 1 it's
mandatory to extend org.apache.struts.action.Actionand implement execute()method which returns
ActionForwardand accept HttpServletRequestand HttpServletResponse. This is not the case with Struts 2, here
Action class can be a simple POJO or Java object with execute()method. Also execute() method returns String rather
than returning ActionForwardobject. You can still use ActionSupportclass or Actioninterface but those are
completely optional.
2) Second main difference between Struts 1 and Struts 2 is on configuration files, earlier we used to configure Struts
using struts-config.xml,but with Struts 2 you can use multiple configuration file, most commonly used as
struts.xml. What is more important is declaration of Struts 2 Filter in web.xml e.g.
<filter>
<filter-name>struts2Fitler</filter-name>
RECOMMENDED FOR YOU
?
<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 notice, instead of mapping this to *.door *.actionwe have mapped it with *, which means all url pattern
will be flown to struts2 filter.
3) One more difference I noticed between Struts 1 and Struts 2 is on Front end Controller. In Struts 1, ActionServletis
Follow Us
Follow @javinpaul
considered as FrontController while in Struts 2 its Filter, which can be considered as front end controller.
4) Another useful enhancement in Struts2 is Interceptor API, which allows to do lot of stuff much easily e.g. file upload
Javarevisited on
Follow
+2,500
javarevisited.blogspot.in/2013/03/difference-between-struts-1-and-struts-2-mvc-framework-jakarta.html
1/3
17/03/2013
Like
Bitwise and BitShift Operators in Java - AND, OR, XOR, Signed Left and Right shift Operator Examples
Difference between Singleton Pattern vs Static Class in Java
Javarevisited: FIX Protocol, tibco,unix and java tutorial with example
How to find duplicate records in a table on database - SQL tips
Recommended by
F acebook social plugin
Subscribe by email:
2 comments:
By Javin Paul
Subscribe
Posts
Comments
Anonymous said...
Hi,
Can you write some article,
listing new component libraries, added on top of various MvcWebFrameworks
which is very easy/quick to use, and has many different object types.
My company is stucked with Struts1 and commonControls, and this is very hard to convince that bureaucracy...
Post a Comment
Ads by Google
List Java
Java Application
Java Interface
Blog Archive
2013 (45)
March (9)
Preview
Home
Older Post
javarevisited.blogspot.in/2013/03/difference-between-struts-1-and-struts-2-mvc-framework-jakarta.html
2/3
17/03/2013
References
Java API documentation JDK 6
Spring framework doc
Struts
ANT
Maven
JDK 7 API
MySQL
Linux
Eclipse
Copyright by Javin Paul 2012. Powered by Blogger.
About Me
Privacy Policy
javarevisited.blogspot.in/2013/03/difference-between-struts-1-and-struts-2-mvc-framework-jakarta.html
3/3