struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Galbraith, Paul" <>
Subject RE: Nested Indexed Property
Date Mon, 23 Sep 2002 13:00:46 GMT
Have you tried single this:

<html:text property='customer[<%= request.getParameter("index") %>].name' />

-----Original Message-----
From: Howard Miller []
Sent: September 21, 2002 6:38 PM
To: Struts Users Mailing List
Subject: RE: Nested Indexed Property

More experimentation.....

Taking your example, what I would *like* to write is....

<html:text property="customer[<%= request.getParameter("index") %>].name" />

where the parameter index comes from the user selection on the previous page. 
Doesn't compile though!! Is there a way of writing the above that will compile?


On 21 Sep 2002 at 13:44, Taylor, Jason wrote:

> I'm not sure how you mean "nested" since there's a tag library called
> "struts-nested" and I'm not sure if you're referring to that.  If you're
> using that, I think you may not need to, depending on the complexity of your
> form.
> If you have only one dimension of arbitrary length,  it's not really a
> "nested" situation, and you can try using the "indexed" property of the
> various html tags (such as html:text).  You need to have an array of beans
> in your action form class with the appropriate get/set methods for each
> "column" in your list.  The array corresponds to the set of request
> parameters sent from an array on the form that you populate using a
> logic:iterate block in the JSP.  Struts will automatically figure out that
> the "customer[0].name" request parameter is the "name" property on the first
> customer bean in your customer bean array in the action form.
> Don't try it with Struts 1.0x, though, as "indexed" is a 1.1 feature...
> -----Original Message-----
> From: Howard Miller []
> Sent: Saturday, September 21, 2002 1:02 PM
> To: struts Users Mailing List
> Subject: Nested Indexed Property
> Hi,
> Sorry for repeating myself, but I think having read a lot more I can ask the
> question 
> with a bit more "intelligence".
> To set the scene may I quote from the documentation:
> "You may also place a bean instance on your form, and use nested property 
> references. For example, you might have a "customer" bean on your Action 
> Form, and then refer to the property "" in your JSP view. This 
> would correspond to the methods customer.getName() and 
> customer.setName(string Name) on your customer bean"
> fine... BUT what if name is a property of an object in the LIST customer. So
> (working backwards) I want to create the reference:
> customer.get( i ).setName(string Name) (oversimplified I know).
> BUT it gets worse.... the index, i, is actually a property set on the
> previous JSP 
> page... so its more like
> customer.get( reqest.getParameter( "index" ) ).setName(string Name )
> ...and of course the form action needs to properly read the current values
> into 
> the form text fields and then set them back into the correct place. I have
> no 
> clue how to do this! Any offers?
> HM
> --
> To unsubscribe, e-mail:
> <>
> For additional commands, e-mail:
> <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message