Home Struts Struts2 Struts2uitags Textfield Tag (Form Tag) Example
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Textfield Tag (Form Tag) Example

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

Textfield Tag (Form Tag) Example

     

In this section, we are going to describe the textfield tag. The textfield tag is a UI tag that is used to render an HTML input field of type text.

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

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

Create a jsp using the tag <s:textfield > that renders an HTML input field of type text.

<s:textfield label="Employee Name" name="empname" size="15" maxlength="10" /> tag displays an HTML text field with label equal to Employee Name with length of 15 columns.

textfieldTag.jsp

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

<html>
  <head>
  <title>Textfield Tag Example</title>
  </head>
  <body>
  <h1><span style="background-color: #FFFFcc">Textfield Tag Example!</span></h1>
  <s:form>
  <s:textfield label="Employee Name"  name="empname" size="15" maxlength="10" />
  </s:form>
  </body>
</html>

Output of the textfieldTag.jsp:

Advertisement

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

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

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
ei ei khin
October 3, 2011
J2EE

please answer me!
DMCA.com