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></h>
<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:
|