Home Struts Struts2 Struts2uitags Form Tag Example



Form Tag Example
Posted on: July 28, 2007 at 12:00 AM
In this section, we are going to describe the form tag . The form tag is a UI tag that renders HTML an input form.

Form Tag Example

     

In this section, we are going to describe the form tag. The form tag is a UI tag that renders HTML an input form. The remote form allows the form to be submitted without the page being refreshed. The results from the form can be inserted into any HTML element on the page.

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

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

Create a jsp using the tag <s:form>.It renders HTML as an input form

formTag.jsp

<%taglib prefix="s" uri="/struts-tags" %>
<html>
  <head>
  <title>Form Tag Example!</title>
  <link href="<s:url value="/css/main.css"/>" 
  rel=
"stylesheet" type="text/css"/>  
  </head>
  <body>
  <h1><span style="background-color: #FFFFcc">Form Tag Example
</span></h1>

  <s:form>
  <s:textfield name="username" label="Login name"/>
  <s:password name="password" label="Password"/>
 <s:submit value="Login" align="center"/>
  </s:form>
  </body>
</html>

Output of the formTag.jsp:

Related Tags for Form Tag Example:
htmlcormforminsertremoterefreshpagesubmitintelementforwithresultstorefwssheitrtecanmitulresultfrominmlrmsubmntoutcaeswithoutemallagemeintossuanyhtmltsllrtttssthmionomo


More Tutorials from this section

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