Java, Struts 1 & 2, Spring, Hibernate, iBatis, Jasper Reports, RDBMS, JDBC, JSP, Servlet, HTML, JS, AJAX, JQuery
Friday, May 1, 2009
Frameworks Comparision
Ajax support
JSF: No Ajax support, use ICEfaces and Ajax4JSF
Stripes: No libraries, supports streaming results
Struts 2: Dojo built-in, plugins for GWT, JSON
Spring MVC: No libraries, use DWR
Tapestry: Dojo built-in in 4.1
Bookmarking and URLs
JSF does a POST for everything - URLs not even considered
Struts 2 has namespaces - makes it easy
Spring MVC allows full URL control
Tapestry still has somewhat ugly URLs
Validation
JSF has ugly default messages, but easiest to configure
Spring MVC allows you to use Commons Validator - a mature solution
Struts 2 uses OGNL for powerful expressions - clientside only works when specifying rules on Actions
Tapestry has very robust validation - good messages without need to customize
Stripes and Wicket do validation in Java - no client-side
Testability
Spring and Struts 2 allow easy testing with mocks (e.g. EasyMock, jMock, Spring Mocks)
JSF page classes can be easily tested and actually look a lot like Struts 2 actions
Saturday, October 6, 2007
Struts 2 Help
Interceptor:-
Interceptors can execute code before and after an Action is invoked. Most of the framework's core functionality is implemented as Interceptors. Features like double-submit guards, type conversion, object population, validation, file upload, page preparation, and more, are all implemented with the help of Interceptors. Each and every Interceptor is pluggable, so you can decide exactly which features an Action needs to support.
Interceptors can be configured on a per-action basis. Your own custom Interceptors can be mixed-and-matched with the Interceptors bundled with the framework. Interceptors "set the stage" for the Action classes, doing much of the "heavy lifting" before the Action executes.
Result Types
Most use cases can be divided into two phases. First, we need to change or query the application's state, and then we need to present an updated view of the application. The Action class manages the application's state, and the Result Type manages the view.
Predefined Result TypesThe framework provides several implementations of the com.opensymphony.xwork2.Result interface, ready to use in your own applications.
| Chain Result | Used for Action Chaining |
| Dispatcher Result | Used for web resource integration, including JSP integration |
| FreeMarker Result | Used for FreeMarker integration |
| HttpHeader Result | Used to control special HTTP behaviors |
| Redirect Result | Used to redirect to another URL (web resource) |
| Redirect Action Result | Used to redirect to another action mapping |
| Stream Result | Used to stream an InputStream back to the browser (usually for file downloads) |
| Velocity Result | Used for Velocity integration |
| XSL Result | Used for XML/XSLT integration |
| PlainText Result | Used to display the raw content of a particular page (i.e jsp, HTML) |
| S2PLUGINS:Tiles Result | Used to provide Tiles integration |
Optional
| JasperReports Plugin | Used for JasperReports Tutorial integration | Optional, third-party plugin |
Additional Result Types can be created and plugged into an application by implementing the com.opensymphony.xwork2.Result interface. Custom Result Types might include generating an email or JMS message, generating images, and so forth.
Editors / IDE for Struts 2
- NetBeans
- IDEA IntelliJ
- Eclipse
Build your struts 2 project using above IDE.