struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <>
Subject Re: Seeking master detail hello world
Date Sun, 12 Sep 2004 20:42:54 GMT
Victor Grazi wrote the following on 9/12/2004 10:28 AM:

> For example if the page is displaying a collection of beans as an html 
> table, and there is an update and delete button on each row, how do you 
> pass the id of the record to those buttons and how does the Action capture 
> the button (update or delete, and record id) that was pressed.

For the example above I usually have the buttons use a bit of javascript 
and use a link to get to the action I want passing the id. There are a 
bunch of other ways you can do it as well. This is just one way. (If not 
using JSP2.0 use html-el button below. Also better to not hardcode the 
button names like I did below and instead use a name from your resources 
file. For sake of brevity I didn't show that below.)

//looping over users on JSP...

<c:url var="url" scope="page" value="/">
   <c:param name="id" value="${}"/>
<input TYPE="button" VALUE="UPDATE" onClick="goToLink('${url}');"/>

<c:url var="url" scope="page" value="/">
   <c:param name="id" value="${}"/>
<input TYPE="button" VALUE="DELETE" onClick="goToLink('${url}');"/>

//javascript somewhere
function goToLink(linkLocation)
     window.location = linkLocation;


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message