struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Hodges <EHod...@USDataworks.com>
Subject RE: Question about logic:iterator, indexId and hidden fields
Date Tue, 06 Apr 2004 18:47:09 GMT
I have both cases:

1. A single form containing lists.  Each element in the list has a submit
button to edit that element.

2. Lists in which each element contains a form.  Each form has a submit
button to edit that element.

-----Original Message-----
From: Richard Yee [mailto:ryee86@yahoo.com]
Sent: Tuesday, April 06, 2004 10:19 AM
To: Struts Users Mailing List
Subject: Re: Question about logic:iterator, indexId and hidden fields


This logic isn't going to help the problem.
> > <logic:iterate index="indexId">
> >   <input type="hidden" value="<c:out
> var="indexId"/>"/>

All it is going to do is create a bunch of input
parameters with type="hidden" and having values of
0,1,2,3 ....


What does your form really look like? Do you have
multiple submit buttons, links? What items are you
indexing? Are you trying to have multiple forms in
your iteration?

Regards,

Richard


--- Adam Hardy <ahardy.struts@cyberspaceroad.com>
wrote:
> 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:David.Karr@wamu.net]
> >> 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:EHodges@USDataworks.com] Sent: Thursday, 
> >>> April 01, 2004 6:30 AM
> >>> To: user@struts.apache.org
> >>> 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:martinc@apache.org]
> >>> Sent: Wednesday, March 31, 2004 10:46 AM
> >>> To: user@struts.apache.org
> >>> Subject: Re: Question about logic:iterator,
> indexId and hidden fields
> >>>
> >>>
> >>>
> >>> "Eric Hodges" <EHodges@USDataworks.com> wrote in
> message
> >>>
>
news:26439701CF1FE441B8EC1A2ADC7E87EE17843A@neptune.usdataworks.com...
> >>>
> >>>> 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?
> >>>
> >>>
> >>>
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

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


Mime
View raw message