Struts 2 date tag formats the date string in two ways, one is by converting to the required format and second is by using the “nice” attribute and converting to the human readable format. This tutorials shows how to use the s:date tag for converting to the different formats for the same input. 1. Action …
Struts
Struts 2 Bean Tag Example
Struts 2 Bean Tag is helpful for assigning a bean reference to the JSP page. Using the s:param attribute, you can pass the values to the bean reference and set the values. After this tag is executed, you can use the bean instance throughout the page. 1. Action Class and Bean Struts2HelloWorldAction.java UserDetails.java 2. Bean …
Struts 2 Action Tag Example
Struts 2 action tag is helpful for executing an action and inserting the result in a particular location of the web page. There are two options with action tag, if the value for the executeResult is set to “true”, then the result is displayed to the page as it is defined in that target view. …
Difference Between FilterDispatcher and StrutsPrepareAndExecuteFilter in Struts 2
If you are working on the Struts 2 applications, you would have noticed that while configuring the Struts 2 filter in your web.xml deployment descriptor, there is two different classes are used. One is org.apache.struts2.dispatcher.FilterDispatcher and another one is org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter. The simple answer is, org.apache.struts2.dispatcher.FilterDispatcher – Used in the early development of Struts 2 and …
Struts 2 Control Tags
Struts 2 provides list of conditional or control tags which is very useful for controlling the flow of an application. The following are the list of important tags listed under conditional tags. If and else Iterator Merge Append Generator 1. The if and else tags This tag is useful for executing the simple if or …
Struts 2 Generator Tag Example
Struts 2 generator tag takes inline array or list of values and pass to the s:iterator to loop through the list of values. 1. Create Struts 2 Action Create action class. 2. Generator Tag Example Write JSP with generator tag to display the list of values. 3. Struts.xml configurations Write struts.xml configuration file. 4. Run …
Struts 2 Merge Tag Example
Struts 2 merge tag is useful for merging the two lists into one object. This is very helpful when you have two different list of objects and then you need to merge them and use it in your JSP page. Merge tag has nested param element to take the multiple list objects in each line. …
Struts 2 Iterator Tag Example
Struts 2 iterator tag is useful for iterating a value which of type java.util.Collections or java.util.Iterator. This example demonstrates with a simple iteration block which is taking the users list and displaying the list of users in the list. 1. Create Data Bean Create a UserDetails.java bean to hold the user details. 2. Create Struts …