struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard Miller" ...@howardmiller.co.uk>
Subject RE: Nested Indexed Property
Date Sat, 21 Sep 2002 22:37:59 GMT
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?

HM

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 [mailto:me@howardmiller.co.uk]
> 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 "customer.name" 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:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 



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


Mime
View raw message