fbpx
Pages Navigation Menu

Coding is much easier than you think

Struts-2 Updates

Advertisements

Different types of form bean in struts 1.X

Posted by on Mar 28, 2013 in Struts 1 | 0 comments

Different types of form bean in struts 1.X

ActionForm Action form for action class. DynaActionForm – No form bean is created. No Validations are done here. Form bean properties are specified in struts-config.xml file ValidatorForm Uses validation framework for validating the form bean. DynaValidatorForm – Similar to the ValidatorForm but form bean is not created and form bean properties are specified in the struts-config.xml file. Validations here are done according to the to the form bean name. ValidatorActionForm – Validations are done according to the action class...

read more

Struts 2 datetimepicker example

Posted by on Mar 27, 2013 in Struts 2 Tutorial, Struts-2 | 3 comments

    To create a date time pick component in struts 2, please follow this two steps :   1. Add struts2-dojo-plugin.jar in your class path. 2. Include the “struts-dojo-tags” tag and its header in your jsp page   ** UPDATE: Struts 2 Complete tutorial now available here.   <%@ taglib prefix="sx" uri="/struts-dojo-tags" %> <html> <head> <sx:head /> </head>   Recommended Article   Datetime picker in struts 2 using jquery jar   Action...

read more

Struts2 Configuration file and its roles

Posted by on Mar 15, 2013 in Struts 2 Tutorial, Struts-2 | 2 comments

  Struts 2 application is mainly dependent on two configuration files. web.xml struts.xml     1. web.xml web.xml is common for all J2EE application and in case of Struts 2, it is used in the configuration of StrutsPrepareAndExecuteFilter, TilesListener etc.   When any request comes for struts web application, that request is first handled by web.xml file, where we do an entry for “StrutsPrepareAndExecuteFilter”, which dispatch a request object to appropriate action...

read more

Pagination in Struts 2 Using display tag

Posted by on Mar 13, 2013 in Display Tag, Struts-2 | 74 comments

    In Struts 2 Pagination can be implemented with the help of Displaytag. This tag can handle feature such as pagination, sorting and exporting of a table. In the following example we will see how to display data using display tag and to do pagination, sorting and exporting.   ** UPDATE: Struts 2 Complete tutorial now available here.   Download the Latest version of displaytag.jar here   Now Create a Dynamic web project and make sure that you have the following libraries are in your WEB-INF/lib...

read more

How To Get The ServletContext In Struts 2

Posted by on Jan 30, 2013 in Struts-2 | 0 comments

How To Get The ServletContext In Struts 2

  In Struts 2 , you can use the following two methods to get the ServletContext object.   1. ServletContextAware   Make your class implements the org.apache.struts2.util.ServletContextAware interface.   ** UPDATE: Struts 2 Complete tutorial now available here.   When Struts 2€ “servlet-config” interceptor is seeing that an Action class is implemented the ServletContextAware interface, it will pass a ServletContext reference to the requested Action class via the setServletContext()method.   package...

read more

Difference between Struts2 FilterDispatcher and StrutsPrepareAndExecuteFilter?

Posted by on Jan 28, 2013 in Struts-2 | 0 comments

Difference between Struts2 FilterDispatcher and StrutsPrepareAndExecuteFilter?

  The FilterDispatcher is used in the early Struts2 development, and it has deprecated since Struts 2.1.3.   ** UPDATE: Struts 2 Complete tutorial now available here.   If you are using Struts version >= 2.1.3, it’s recommended to upgrade the new filter class StrutsPrepareAndExecuteFilter   The new filter was introduced for the following reasons There were a lot of issued with the FilterDispatcher and its deployment. New Filter provides a better way to enable customizations and overrides. Make it crystal clear to...

read more

File Upload Example in Struts 2

Posted by on Nov 18, 2012 in Struts 2 Tutorial, Struts-2 | 5 comments

File Upload Example in Struts 2

  In Struts 2 file uploading can done with the help of built-in FileUploadInterceptor. We use <s:file> tag to create a file upload component, which allow users to select file from their local disk and upload it to the server. The encoding type of the form should be set to multipart/form-data and the HTTP method should be set to post. The Struts 2 File Upload Interceptor is based on MultiPartRequestWrapper, which is automatically applied to the request if it contains the file element. Then it adds the following parameters to the...

read more
%d bloggers like this: