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 21:39:08 GMT
No, I have never used struts-nested.

The documentation says that the "indexed" property is only for use inside a 
logic:iterate tag. I'm not inside a logic iterate tag.

To put it as simply as possible.

Page 1 has a link: <a href="page2.jsp?index=5">
(and I accept that this might be page2.do!!

and page 2 needs to do 
<html:text name="beanwithlist[ index ]" property="name" />

geddit? index is a property generated according to the user selection on the previous 
page. This is what I need to index the data by. The second page would be a simple, 
basic edit form but for the fact that I have no idea how to reference the bean it uses 
because it is part of a linked list in some other bean with a dynamic reference.

Phew,,,,

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