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

Struts 2 s:datetimepicker UI tag

<s:datetimepicker>: The <s:datetimepicker> tag is a dojo ajax tag and create a text box with a calendar icon. When calendar icon is clicked it will open the date time picker component. Syntax: <sx:datetimepicker name=”fieldName” label=”fieldLabel” displayFormat=”dateFormat”/> Note: Add <sx:head /> in the head element of your jsp. Example: test.jsp <%@ taglib uri="/struts-tags" prefix="s"%> <%@ taglib … Read more

Struts 2 s:optiontransferselect UI tag

<s:optiontransferselect>: The <s:optiontransferselect> tag is used to create the option transfer select component which is the combination of two updownselect components. It contains the buttons to move the selected items between the two updownselect components. Syntax: <s: optiontransferselect name=”firstDropDownName” list=”firstDropDownValueList” doubleName=”secondDropDownName” doubleList=”secondDropDownValueList” /> Example: index.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Struts … Read more