Thursday 8 December 2011

Java/Struts interview questions: - Elaborate the difference between Struts 1.x and Struts 2.x

Struts 1.xStruts 2.x
Configuration of ActionServlet via servletConfiguration of FilterDispatcher is via filters
Struts1 extends the abstract base class
by its action class
Implements Action interface but not a compulsion.
 Any POJO class can behave like Action
Follows FrontController patternFollows FilterDispacther pattern
Extra care has to be taken to make resources
 thread safe because Actions are singletons
Action objects are instantiated for each request and
 hence are inherently thread safe
Testing is a problem since execute() method
exposes Servlet API
Testing is easier
ActionForms serves are inputAny POJO can serve as input
Binds objects in page using standard mechanismBinds objects using valuestack
Type conversions are using common-beanutils.jarType conversions are using OGNL
General notation for config file is Struts-config.xml
 is used
General notation for config file is struts.xml
No concept of namespaceNamespace are readily available for modularity

Also see the following interesting video on Struts: -

Know more on  Java/Struts interview questions


Get more on Java/Struts interview questions from author’s blog

1 comment:

  1. Struts Interview Questions and Answers