struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sri Sankaran" <Sri.Sanka...@sas.com>
Subject RE: <html:form> WITHIN a <logic:iterate> tag
Date Thu, 27 Feb 2003 14:16:46 GMT
Couple of things to note:

* The attribute value for a tag must either be *entirely* a
  literal or *entirely* a JSP expression.  In other words you can't
  have foo="bar<%=baz.getXYZ()%>"
* The name attribute of an <html:form> is deprecated in Struts 1.1

I would recommend simply using your hidden variable and configuring a single action to process
the user request.

Sri
-----Original Message-----
From: Ian Hunter [mailto:ihunter@hunterweb.net] 
Sent: Thursday, February 27, 2003 8:47 AM
To: Struts Users Mailing List
Subject: <html:form> WITHIN a <logic:iterate> tag


I looked through the archive before posting this, but there was just so much stuff in there
about forms and select that my eyes glazed over and I gave up.

What I want to do is have a series of items from a database appear on a page, in a table,
each one to a row.  At the end of the row, in one column, I want to have edit and delete buttons
that refer to the specific item by primary key.  I can do this in other scripting languages
by doing stuff like

<% for variable = 1 to whatever %>
<form name="editItem<%=variable.loopcounter%>" action="editpage"><input type="submit"
value="Edit"></form> <% next/loop/end/whatever pick your scripting language %>

but with struts/JSP if I say

<logic:iterate id="bulletin" type="BulletinForm" name="bulletinVector"> <tr>
    <td class="bulletindate"><jsp:getProperty name="bulletin" property="datePosted"/></td>
    <td><jsp:getProperty name="bulletin" property="message"/></td>
    <td valign="center" align="right">
    <html:form name="editBulletinForm<%=bulletin.getId()%>"
action="editbulletin" type="BulletinForm">
    <html:hidden property="id" value="<%=bulletin.getId()%>"/>
    <html:submit value="Edit"/>
    </html:form>
    <html:form name="deleteBulletinForm<%=bulletin.getId()%>"
action="deletebulletin" type="BulletinForm">
    <html:hidden property="id" value="<%=bulletin.getId()%>"/>
    <html:submit value="Delete"/>
    </html:form>
    </td>
</tr>
<tr><td colspan="3"><hr width="100%"/></td></tr> </logic:iterate>

That doesn't fly because <%=bulletin.getIds()%> doesn't get expanded within the <html:form>
tag.

SURELY someone has done this with struts.  Help?


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message