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:
![]() |
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.
Ask Questions? Discuss: Textfield Tag (Form Tag) Example View All Comments
Post your Comment