Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Struts Struts2 Struts2uitags Label Tag (Form Tag) Example

Related Tutorials


 
 

Share on Google+Share on Google+

Label Tag (Form Tag) Example

Advertisement
In this section, we are going to describe the label tag .

Label Tag (Form Tag) Example

     

In this section, we are going to describe the label tag. The label tag is a UI tag that is used to render an HTML LABEL that allows us to output label:name type of combinations that has the same format treatment as the rest of UI controls.

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

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

Create a jsp using the tag <s:label>. It renders an HTML LABEL that allows us to output <s: label name=" " value=" " /> combination that has the same format treatment as the rest of UI controls.

labelTag.jsp

<%taglib prefix="s" uri="/struts-tags" %>
<html>
  <head>
  <title>Label Tag Example!</title>
  </head>
  <body>
  <h1><span style="background-color: #FFFFcc">Label Tag Example
</span></h1>

  <s:form>
  <s:label name="name" value= "Name" />
  <s:label name="roll" value= "Roll" />
  <s:label name="address" value= "Address: " />

  </s:form>
  </body>
</html>

Output of the labelTag.jsp:

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 28, 2007

Related Tutorials

Discuss: Label Tag (Form Tag) Example   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com