You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Howard Miller <me...@howardmiller.co.uk> on 2002/10/13 09:01:32 UTC

pre-populate nightmare

Hi,

I have been trying to get a pre-populate thing to work for about two weeks now and 
am going crazy.... can somebody sanity check what I am doing. Much appreciated!!

Its a master detail type of thing. I show a list of options a user can edit on one page, 
and the details of the item to edit on the next page. As the master list is an array of 
beans, the "edit" page form just contains one property of the bean type. So there is 
some nesting going on. Anyway the target page is called "builder", so I do this...

On my master page, the user selects one of the things to edit. The link has an id=n 
property tacked on, so in the action class for this page I create a new bean for the 
following "builder" page, copy the appropriate object from the array, and store the 
results in request scope with the name "builderForm". (the array is in a session scope 
object BTW)

I now simply forward to "success" which is mapped in struts-config to "builder.jsp".

The form displays with the correct data in it. Happy so far.

I hit submit and I get an exception:

java.lang.IllegalArgumentException: No bean specified at 
org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(Property
Utils.java:816) at 
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:846) 

it isn't getting as far as the Action class for the builder page as I have set a 
breakpoint there.

Stuck (again).... any help appreciated.

HM

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pre-populate nightmare

Posted by Howard Miller <me...@howardmiller.co.uk>.
I'm going to answer my own question:

create the bean for the target "builder" page in the session scope, not the request 
scope. Having several cups of coffee, a walk, and a long think, led me to this logical 
conclusion (if I want to manipulate a bean that exists in a session data structure, then 
the bean I copy it to has to exist accross multiple pages too). However I still have an 
uneasy feeling that I may be doing this the wrong way.

Any comments appreciated. Getting a bit frazzled with all this.

HM

On 13 Oct 2002 at 8:01, Howard Miller wrote:

> Hi,
> 
> I have been trying to get a pre-populate thing to work for about two weeks now and 
> am going crazy.... can somebody sanity check what I am doing. Much appreciated!!
> 
> Its a master detail type of thing. I show a list of options a user can edit on one page, 
> and the details of the item to edit on the next page. As the master list is an array of 
> beans, the "edit" page form just contains one property of the bean type. So there is 
> some nesting going on. Anyway the target page is called "builder", so I do this...
> 
> On my master page, the user selects one of the things to edit. The link has an id=n 
> property tacked on, so in the action class for this page I create a new bean for the 
> following "builder" page, copy the appropriate object from the array, and store the 
> results in request scope with the name "builderForm". (the array is in a session scope 
> object BTW)
> 
> I now simply forward to "success" which is mapped in struts-config to "builder.jsp".
> 
> The form displays with the correct data in it. Happy so far.
> 
> I hit submit and I get an exception:
> 
> java.lang.IllegalArgumentException: No bean specified at 
> org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(Property
> Utils.java:816) at 
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:846) 
> 
> it isn't getting as far as the Action class for the builder page as I have set a 
> breakpoint there.
> 
> Stuck (again).... any help appreciated.
> 
> HM
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>