Hi,
I have
struts 2 question that i cannot find the answer for. can someone please help.
I have a table dynamically return after pressing search. in front of each row a dynamically delete button is created. how can I associate each button to the record:
JSP:
<div>
<s:iterator value="users" status="index" >
<s:if test="#index.first == true">
<tr style="font-weight:bold; background: #2E2E2E ">
<td></td>
<td></td>
<td>User ID</td>
<td>First Name</td>
<td>Last Name</td>
<td>Email</td>
<td>Status</td>
<td>Type</td>
</tr>
</s:if>
<s:if test="#index.odd == true">
<tr style="background: grey">
</s:if>
<s:else>
<tr style="background: #0B243B ">
</s:else>
<td><s:submit type="image" src="images/icons/deleteButton.ico" theme="simple" method="delete" name="myUser" value="<s:property value='userID'/>" /></td>
<td><s:property value="userID"/></td>
<td><s:property value="firstName"/></td>
<td><s:property value="lastName"/></td>
<td><s:property value="email"/></td>
<td><s:property value="statusID"/></td>
<td><s:property value="typeID"/></td>
</tr>
</s:iterator>
</div>
Action:
public class userAdminAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private
String myUser;
public String delete() throws Exception {
System.out.println("delete:");
System.out.println("My User is: " + myUser);
return "success";
}
public String getMyUser() {
return myUser;
}
public void setMyUser(String myUser) {
this.myUser = myUser;
}
}
OUTPUT:
delete:
My User is: null
Can someone please help........