Home Struts Struts2 Struts2uitags Textfield Tag (Form Tag) Example



Textfield Tag (Form Tag) Example
Posted on: July 28, 2007 at 12:00 AM
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:

Related Tags for Textfield Tag (Form Tag) Example:
htmltextuiinputsedtypetagfieldrendertextfieldtexietoldexteputusepeinmlmendsathtmishatfxtssrenthhatndonp


More Tutorials from this section

Ask Questions?    Discuss: Textfield 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.