Java Reference
In-Depth Information
The src= attribute contains the path to the image:
Download email_19/web/WEB-INF/jsp/message_compose.jsp
<c:set var="arrow" value="/images/arrow.png"/>
<tr>
<th> To: </th>
<td><s:text name="message.to" size="60"/></td>
<td><s:image name="addTo" src="${arrow}"/></td>
</tr>
<tr>
<th> Cc: </th>
<td><s:text name="message.cc" size="60"/></td>
<td><s:image name="addCc" src="${arrow}"/></td>
</tr>
<tr>
<th> Bcc: </th>
<td><s:text name="message.bcc" size="60"/></td>
<td><s:image name="addBcc" src="${arrow}"/></td>
</tr>
This generates <input type="image" ...> tags. So, what does the <s:image>
tag do for us? It adds the application context path in front of the image
path and gives us the ability to look up images and alternate text in
localized resource bundles, as we'll see in Section 11.2 , Localizing Image
Buttons, on page 232 .
When the user clicks an arrow button, the selected contacts are added
to the addresses that are in the field next to the button. But the user
may have also entered other addresses directly in the text field. Com-
bining the input of the text field with the input from the select box is
somewhat tricky; we'll discuss this in the next chapter. Let's continue
working with form input controls.
Adding the text area for the message text is a one-liner with the tag
<s:textarea>:
Download email_19/web/WEB-INF/jsp/message_compose.jsp
<s:textarea name="message.text" cols="87" rows="12"/>
Again, using the Stripes equivalent instead of the plain HTML tag has
the benefit of automatically repopulating the value—we don't want the
user to lose the text if the form is submitted and a validation error
occurs.
 
 
Search WWH ::




Custom Search