Home Struts Struts2 Struts2uitags Checkbox Tag (Form Tag) Example



Checkbox Tag (Form Tag) Example
Posted on: July 28, 2007 at 12:00 AM
In this section, we are going to describe the checkbox tag .

Checkbox Tag (Form Tag) Example

     

In this section, we are going to describe the checkbox tag. The checkbox tag is a UI tag that is used to render an HTML input element of type checkbox, populated by the specified property from the ValueStack. 

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

<action name="checkboxTag">
   <result>/pages/uiTags/checkboxTag.jsp</result>
</action>

Create a jsp using the tag <s:checkbox> It renders an HTML input element of type chechbox.
checkboxTag.jsp 

<%taglib prefix="s" uri="/struts-tags" %>

<html>
  <head> 
  <title>Checkbox  (Form TagTag Example!</title>
  </head>
  <body>
  <h1><span style="background-color: #FFFFcc">
Checkbox Tag Example!</span></h1>

  <b>Sex</b><br>
  <s:checkbox label="Male" name="male" value="true" /><br>
  <s:checkbox label="Female" name="male" />

  </body>
</html>

Output of the checkboxTag.jsp :

Related Tags for Checkbox Tag (Form Tag) Example:
htmlcuiinputcheckboxstackpropertysedtypevaluetagelementrendercheckifieboxvaluestociepopulateputuseulpepopfrominmlstamntesspecemendmeproacksspatlatekhtmishaproperrtropevassrenthstaluhatkbpropprndomonp


More Tutorials from this section

Ask Questions?    Discuss: Checkbox Tag (Form Tag) Example   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.