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

Struts 2 s:sort control tag

s:sort: The s:sort tag is used to sort a List by using java.util.Comparator. Syntax: <s:sort comparator=”#comparatorName” source=”fieldName”> Example: index.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Struts 2 s:sort control tag example</title> <META HTTP-EQUIV="Refresh" CONTENT="0;URL=Test.action"> </head> <body> </body> </html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Struts 2 s:sort control tag example</title> … Read more

Struts 2 s:generator control tag

s:generator: The s:generator tag is used to generate an iterator based on the specified value in the val attribute. Syntax: <s:generator val= Example: index.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Struts 2 s:generator control tag example</title> <META HTTP-EQUIV="Refresh" CONTENT="0;URL=Test.action"> </head> <body> </body> </html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Struts … Read more

Struts 2 s:append control tag

s:append: The s:append control tag is used to append the two or more iterator values into a single iterator value. It uses s:param tag to take the iterator values as parameters. Syntax: <s:append var="varName"> <s:param value="%{iterator1}" /> <s:param value="%{iterator2}" /> </s:append><s:append var="varName"> <s:param value="%{iterator1}" /> <s:param value="%{iterator2}" /> </s:append> Note: First all elements of first … Read more

Struts 2 merge control tag

s:merge: The s:merge control tag is used to merge the two or more iterator (List or Map) values into a single iterator value. It uses s:param tag to take the iterator values as parameters. Syntax:  <s:merge var="varName"> <s:param value="%{iterator1}" /> <s:param value="%{iterator2}" /> </s:merge><s:merge var="varName"> <s:param value="%{iterator1}" /> <s:param value="%{iterator2}" /> </s:merge> Note: If iterators … Read more

Struts 2 iterator control tag

s:iterator: The iterator tag is used to iterate over a value. The value can be any of the java.util.Collection or java.util.Iterator. Syntax:  <s:iterator value="fieldValue"> //do something </s:iterator><s:iterator value="fieldValue"> //do something </s:iterator> Note: The IteratorStatus class is used to get the iteration status details like count, even, odd etc. To use this functionality we have to … Read more

Struts 2 If, else if and else control tag

if-elseif-else tag: The if-elseif-else tag is used for the conditional processing i.e. a block of statements executed based on some conditions. Syntax:  <s:if test=”%{condition1}”> //block of statements </s:if> <s:elseif test="%{condition2}"> //block of statements </s:elseif> <s:else> //block of statements </s:else><s:if test=”%{condition1}”> //block of statements </s:if> <s:elseif test="%{condition2}"> //block of statements </s:elseif> <s:else> //block of statements </s:else> … Read more

Struts 2 control tags

Struts 2 control tags are used to control the flow execution, conditional processing, manipulating, iterating and displaying the data. Commonly used struts 2 control tags: Struts 2 control tags with example.Struts2 control tags example tutorial. How to use control tags in struts2. Control tags in struts2. Let us discuss all Struts 2 control tags with … Read more

Struts 2 sx:autocompleter UI tag

<sx:autocompleter>: The <sx:autocompleter> tag is used to create auto completer i.e. it creates a input box when user write something it automatically generates a drop down suggestion list. It is dojo ajax tag. Syntax: <sx:autocompleter label=”fieldLabel” list=”valueList” name=”fieldName” /> Note: Add <sx:head /> in the head element of your jsp. Example: index.jsp <!DOCTYPE HTML PUBLIC … Read more