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



Home Struts Struts2 Struts2uitags Form Tag Example

Related Tutorials


 
 

Share on Google+Share on Google+

Form Tag Example

Advertisement
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:

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: Form Tag Example   View All Comments

Post your Comment


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