Magazine
 
Struts2 Tags

Output of the optgroupTag.jsp:

12. Password Tag (Form Tag) Example

The password tag is a UI tag that renders an HTML input tag of type password.

Add the following code snippet into the struts.xml file

<action name=”passwordTag”>
<result>/pages/formTags/
passwordTag.jsp</result>
</action>

Create a jsp using the tag <s:password> It renders an HTML input tag of type password.

passwordTag.jsp

<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head>
<title>Password Tag Example</title>
</head>
<body>

 

<h2>Password Tag Example</h2>
<s:form>
<s:password label=”Enter Password”
name=”password” size=”10" maxlength=”8" /
>
</s:form>
</body>
</html>

Output of the passwordTag.jsp:

13. Radio Tag (Form Tag) Example

The radio tag is a UI tag that renders a radio button input field.

Add the following code snippet into the struts.xml file

<action name=”radioTag”
class=”net.javajazzup.checkboxlistTag”>
<result>/pages/formTags/radioTag.jsp</
result>
</action>

Create an action class with two lists as shown below:

checkboxlistTag.java

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

Feb 2008 | Java Jazz Up | 47
 
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