I have both cases. Some of my forms are outside the iterator, others inside. The common factor is that each iteration produces its own <nested:submit> tag. I have lists of things. Each thing has a button that lets the user edit that particular thing.
Am I missing an obvious pattern here? Surely lots of struts web apps do this sort of thing. -----Original Message----- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 9:58 AM To: Struts Users Mailing List Subject: Re: Question about logic:iterator, indexId and hidden fields Actually you might need a name attribute on that hidden field as well ... which could get complicated. It depends on where you form is. Inside or outside the logic:iterate? On 04/06/2004 06:43 PM Adam Hardy wrote: > This is pseudo-code, so before use it'll need corrections! For JSP2 & JSTL > > <logic:iterate index="indexId"> > <input type="hidden" value="<c:out var="indexId"/>"/> > > > > On 04/06/2004 06:30 PM Eric Hodges wrote: > >> Does anyone know of a simple way to send a logic:iterate's indexId >> back as a >> form bean property on submit? >> >> >> -----Original Message----- >> From: Eric Hodges Sent: Friday, April 02, 2004 7:24 AM >> To: Struts Users Mailing List >> Subject: RE: Question about logic:iterator, indexId and hidden fields >> >> >> I mean when the page is compiled, the <nested:submit> tag is converted >> to an >> <input> tag before the <%=index%> tag produces Java code. >> >> I think the taglib directive *is* incorrect whenever I get the <%=index%> >> tag to produce Java code, that's why it leaves <nested:submit> in the >> HTML >> output. When I remove the <%=index%> tag, or when I include it in such a >> way that it doesn't generate Java code, the <nested:submit> tag is >> recognized. >> >> What I want to do is write a <nested:submit> tag that passes the value of >> Integer "index" to a Javascript function in its "onClick" function. >> >> >> >> -----Original Message----- >> From: Karr, David [mailto:[EMAIL PROTECTED] >> Sent: Thursday, April 01, 2004 8:02 AM >> To: Struts Users Mailing List >> Subject: RE: Question about logic:iterator, indexId and hidden fields >> >> >> I think we're having trouble understanding what you're doing. In >> particular, you say that "the <nested:submit> tag is evaluated before >> the <%=index%> tag". What do you mean by that? Then, you are now >> saying that after fixing your scriptlet expression reference, you say >> that the "<nested:submit> tag isn't replaced with an <input> tag". Do >> you mean that in the HTML output, you see "<nested:submit ..>" instead >> of "<input ...>"? If you're really seeing "<nested:submit ...>" in the >> HTML output, then this would indicate that your taglib directive is >> incorrect or not present. >> >> >>> -----Original Message----- >>> From: Eric Hodges [mailto:[EMAIL PROTECTED] Sent: Thursday, >>> April 01, 2004 6:30 AM >>> To: [EMAIL PROTECTED] >>> Subject: RE: Question about logic:iterator, indexId and hidden fields >>> >>> >>> Thanks for the suggestion, but that doesn't work either. The >>> <nested:submit> tag isn't replaced with an <input> tag when I use the >>> syntax >>> you suggest. I've tried many variations on these syntaxes. If the JSP >>> expression get's parsed, the struts tags aren't understood. If the >>> struts >>> tags are understood the JSP expression isn't parsed. >>> >>> Any other ideas? Surely this is a common usage pattern. >>> >>> -----Original Message----- >>> From: Martin Cooper [mailto:[EMAIL PROTECTED] >>> Sent: Wednesday, March 31, 2004 10:46 AM >>> To: [EMAIL PROTECTED] >>> Subject: Re: Question about logic:iterator, indexId and hidden fields >>> >>> >>> >>> "Eric Hodges" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>> >>>> I have a form with a list of elements on it. Each element >>> >>> >>> has an "Edit" >>> >>>> button associated with it. When the user clicks the Edit >>> >>> >>> button for a >>> >>>> specific element, I want to send back the value of indexId >>> >>> >>> in a hidden >>> field >>> >>>> on the form. I can't figure out a clean way to do this. The >>> >>> >>> documentation >>> >>>> says "indexId" will create a bean, but it really creates an >>> >>> >>> Integer (which >>> >>>> isn't a JavaBean). I've tried passing my indexId to a >>> >>> >>> Javascript function >>> >>>> that sets the form's hidden field sort of like this: >>>> >>>> <nested:submit propert="edit" value="Edit" >>>> onclick="setEditIndex(<%=index%>)"/> >>>> >>>> but the <nested:submit> tag is evaluated before the <%=index%> tag >>> >>> >>> The problem is that you have illegal JSP syntax for the 'onclick' >>> attribute. >>> The attribute value must be a string literal or a scripting >>> expression. You >>> cannot mix the two. Try this instead: >>> >>> onclick='<%= "setEditIndex(" + index + ")" %>' >>> >>> -- >>> Martin Cooper >>> >>> >>> >>>> >>>> Right now I've got some ugly JSP code that outputs the >>> >>> >>> submit element that >>> >>>> calls the Javascript function that sets the hidden field. >>> >>> >>> There must be a >>> >>>> simpler way. Any ideas? >>> >>> >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- struts 1.2 + tomcat 5.0.19 + java 1.4.2 Linux 2.4.20 Debian --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]