struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Hodges <>
Subject RE: Question about logic:iterator, indexId and hidden fields
Date Thu, 01 Apr 2004 14:29:45 GMT
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 []
Sent: Wednesday, March 31, 2004 10:46 AM
Subject: Re: Question about logic:iterator, indexId and hidden fields

"Eric Hodges" <> wrote in message
> 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
> on the form.  I can't figure out a clean way to do this.  The
> 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:
For additional commands, e-mail:

View raw message