Java Reference
In-Depth Information
Figure 3.10: The contact form
model objects, that's no problem either—Stripes happily uses deeply
nested properties, such as "contact.address.street.name" . Let's put all this
to work and build a form for contacts.
Creating a Blank Form
The <s:form> tag creates a form associated with the action bean indi-
cated in its beanclass= attribute. Within the tag, we add input fields
with tags such as <s:text>, <s:radio>, and every other type of input.
These tags all have a name= attribute in which we put the name of the
action bean property that receives the user's input. To complete the
form, we add one or more submit buttons with the <s:submit> tag and
the name= of the event handler associated with the button.
Have a look at the following code. This creates the form shown in Fig-
ure 3.10 :
Download email_05/web/WEB-INF/jsp/contact_form.jsp
Ê
<s:form beanclass="stripesbook.action.ContactFormActionBean">
<table class="form">
<tr>
<td> Email: </td>
Ë
<td><s:text name="contact.email"/></td>
</tr>
<tr>
<td> First name: </td>
<td><s:text name="contact.firstName"/></td>
</tr>
 
 
 
Search WWH ::




Custom Search