I just got help with the following Struts2 form in my JSP. No values are being displayed. Can anyone help?
<s:iterator value="bulletins">
<s:if test="approved == false">
<s:form action="ApproveBulletin" method="post">
<table>
<tr>
<td colspan="2"><b>From:</b> <s:property value="name" /></td>
</tr>
<tr>
<td colspan="2"><b>Subject:</b> <s:property value="subject" /></td>
</tr>
<tr>
<td colspan="2"><b>Date:</b> <s:property value="date" /> <br>
</td>
</tr>
<tr>
<td colspan="2"><s:property value="note" />
<s:hidden name="id" value="id" /></td>
</tr>
<tr>
<td><s:submit type="button" value="approve" label="Approve"
action="ApproveBuletin" /></td>
<td><s:submit type="button" value="deny" label="Deny"
action="DenyBulletin" /></td>
</tr>
</table>
<br />
</s:form>
</s:if>
</s:iterator>
This is the code from my action class that passes my iterator to my JSP.
public String execute() {
BulletinDAO bulletinDAOInstance = new BulletinDAO();
List<Bulletin> bulletins = bulletinDAOInstance.getAllBulletins();
if (bulletins != null) {
HttpSession session = (HttpSession) request.getSession();
session.setAttribute("bulletins", bulletins.iterator());
return "success";
}
return "failure";
}
Here is the code I used to finally get the id variable to render in the hidden tag. It didn’t need much.