Java Reference
In-Depth Information
contact_list.jsp
<s:link beanclass="${actionBean.class}"
event="delete">
<s:param name="contactId"
value="${contact.id}"/>
Delete
</s:link>
ContactListActionBean.java
public void setContactId(Integer id)
public Resolution delete()
Figure 3.6: Binding a link parameter
Viewing Contact Information Details
Clicking the View link brings the user to a page that shows the contact
add code in
ContactListActionBean
to receive the parameter, retrieve the
contact, and forward to the view:
private static final
String VIEW="/WEB-INF/jsp/contact_view.jsp";
public
Resolution view() {
return new
ForwardResolution(VIEW);
}
private
Integer contactId;
public void
setContactId(Integer id) {
contactId = id;
}
public
Contact getContact() {
return
contactDao.read(contactId);
}
Notice that the
contactId
property is of type
Integer
, even though all
parameters that come from an HTTP request are limited to the
String
type. Stripes automatically converts the parameter to an
Integer
for us.
Search WWH ::
Custom Search