Struts 2 i18n and text data tags

<s:i18n>: The <s:i18n> tag is used to get the message from the resource bundle which is associate to an action or from any other resource. Syntax: <s:i18n name=”resourceUrl”>  Note: In case of resource bundle associate with the action, you have to create the properties file in the same package and having the same name as … Read more

Struts 2 set data tag

<s:set>: The <s:set> tag is used to set a variable value or assign a value to a variable in a specific scope. Scope can be application, session, request, page or action. Default scope actsion. Syntax: <s:set var=”varName” value=”varValue” /> Example: test.jsp <%@ taglib uri="/struts-tags" prefix="s"%> <html> <head> <title>Struts 2 s:set data tag example</title> </head> <body> … Read more

Struts 2 push data tag

<s:push>: The <s:push> tag is used to push a value on the top of the stack to access it easily. Syntax: <s:push value="beanReference"> <s:propery value="property1" /> <s:propery value="property2" /> </s:push><s:push value="beanReference"> <s:propery value="property1" /> <s:propery value="property2" /> </s:push> Note: We can see in the previous s:property tag example that we have to use bean reference … Read more

Struts 2 property data tag

<s:property>: The <s:property> tag is used to get the property of a specified value. If no value is specified then it gives the property from the top of the stack. Syntax: <s:property value=”valueName”/> Example: test.jsp <%@ taglib uri="/struts-tags" prefix="s"%> <html> <head> <title>Struts 2 s:property data tag example</title> </head> <body> <h3>This is a s:property data tag … Read more

Struts 2 param data tag

<s:param>: The <s:param> tag is used to pass parameters in the other tags or we can say to parameterized other tags like bean, url tags. Syntax: <s:param name=”paramName”>paramValue</s:param> Or <s:param name=”paramName” value=”paramValue” /><s:param name=”paramName”>paramValue</s:param> Or <s:param name=”paramName” value=”paramValue” /> Example: test.jsp <%@ taglib uri="/struts-tags" prefix="s"%> <html> <head> <title>Struts 2 s:param data tag example</title> </head> <body> … Read more

Struts 2 date data tag

<s:date>: The <s:date> tag is used to format the date object by using custom formats or easily readable format using nice attribute. If nice attribute is set to true then it display the date in the easily readable format like an instant ago. Syntax: <s:date name=”dateField” format=”dateFormat” /> Example: index.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML … Read more

Struts 2 bean data tag

<s:bean>: The <s:bean> tag is used to create an instance of a bean in your jsp page. It can take parameters to set the bean properties. After setting the bean properties value it put the bean object in the value stack to make it accessible on the jsp page. Syntax: <s:bean name="beanName" var="beanVar"> <s:param name="property1" … Read more

Struts 2 include data tag

<s:include>: The <s:include> tag is used to include the result of any other resource. Other resource can be JSP, HTML or servlet etc. It acts similar to the jsp include. Syntax: <s:include value=”resourceUrl”/>   Note: It can take parameters using s:param tag. Example: test.jsp <%@ taglib uri="/struts-tags" prefix="s"%> <html> <head> <title>Struts 2 s:include data tag example</title> … Read more

Struts 2 action tag

<s:action>: Tha <s:action> tag is used to call the action directly from a jsp page. By default all the results defined in struts.xml for thactsion will be ignored and control will not be transferred to the result. IfexecuteResult attribute is set to true then results defined in struts.xml for thactsion will work and the result … Read more

Struts 2 data tags

Struts 2 data tags are used to manipulate and display the data. Data tags interact with the ValueStack to get and set the data. Commonly used struts 2 data tags: Struts 2 data tags with example.Struts2 data tags example tutorial. How to use data tags in struts2. Let us discuss all Struts 2 data tags … Read more