Magazine
 
Struts2 Tags
The tag <s:checkboxlist name=”Animals-name”
list=”animals” /> prints a combobox with name
Fruits Name and an HTML INPUT of type text
and HTML SELECT grouped together created
using the “fruits” list of the action class
“checkboxlistTag”.

comboboxTag.jsp

<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head>
<title>Combobox (Form Tag) Tag
Example</title>
</head>
<body>
<h2>Combobox Tag Example</h2>
<s:form>
<s:combobox label=”Colors Name”
name=”colorNames”
headerValue=”— Please Select —”
headerKey=”1"
list=”{‘Black’,’Green’,’White’,’Yellow’,
‘Red’,’Pink’}” />
<s:combobox label=”Fruits Name”
name=”fruitsNames”
headerValue=”— Please Select —”
headerKey=”1" list=”fruits” />
</s:form>
</body>
</html>

Output of the comboboxTag.jsp:

 

 

5. Datetimepicker Tag (Form Tag) Example

The datetimepicker tag is a UI tag that is used to render a date/time picker in a dropdown container. A stand-alone DateTimePicker widget makes it easy to select a date/time, or increment by week, month, and/or year. It is
possible to customize the user-visible formatting with either the ‘formatLength’ (long, short, medium or full) or ‘displayFormat’ attributes. By defaulty current locale will be used.

Add the following code snippet into the struts.xml file.

<action name=”datetimepickerTag”
class=”net.javajazzup.includeTag”>
<result>/pages/formTags/
datetimepickerTag.jsp</result>
</action>

Create an action class as shown:

includeTag.java

package net.javajazzup;
import
com.opensymphony.xwork2.ActionSupport;
import java.util.*;
public class includeTag extends ActionSupport
{

Feb 2008 | Java Jazz Up | 41
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 ,

Download PDF