Hello,
What does the getFormData method return?
It should be a bean with exactly the same properties as your
dynavalidatoraction form..
Regards
marco
-----Original Message-----
From: Norris Shelton [mailto:[EMAIL PROTECTED]
Sent: 09 February 2005 17:08
To: Struts Users Mailing List; Dakota Jack
Subject: Re: How do I prefill a form
Here is the entire contents of my init method:
if (form == null) {
form = new DynaValidatorActionForm();
}
CommonTools.formDataCopy(request, form);
return mapping.findForward("searchName");
If I break on the CommonTools line and put my mouse on the form,
I see form is not null, but is empty.
The contents of the formDataCopy method is:
BeanUtils.copyProperties(object, getFormData(request));
The getFormData method retrieves the "formData" bean from the
request. The bean exists and has the previously entered
information.
If I let the request run it's couse, I get an error message:
12:04:26,098 WARN [RequestProcessor] Unhandled Exception
thrown: class java.lang.NullPointerException
java.lang.NullPointerException
at
org.apache.commons.beanutils.PropertyUtils.isWriteable(PropertyUtils.jav
a:1285)
at
org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:259
)
at
com.appriss.jxportal.CommonTools.formDataCopy(CommonTools.java:281)
at
com.appriss.jxportal.search.SearchAction.nameInit(SearchAction.java:47)
CommonTools.java:281 is the BeanUtils.copyProperties line. It
seems like I am not creating the form correctly.
--- Dakota Jack <[EMAIL PROTECTED]> wrote:
> <snip>
> On Wed, 9 Feb 2005 08:04:44 -0800 (PST), Norris Shelton
> <[EMAIL PROTECTED]> wrote:
> > I am using a LazyValidatorForm for each area of my site.
> They
> > want information entered on a form in one part of the site
> to be
> > the default value when a form in another part of the site is
> > displayed. I am accumulating the information that is
> entered in
> > a session bean. I then tried to copy that to the form for
> the
> > current action before it is displayed. The form comes in as
> > null. I then tried to create a new form it it's null, but
> it
> > gets a NPE on the toString() method.
> >
> > Is there a way to do this?
> >
> </snip>
>
> If you showed a bit of your code, that would tell us what you
> are
> doing. This is fairly simple, actually. Where you get the
> information for the second form is rather beside the point.
> If you
> have the information and a way to store it on the form and do
> so in
> your action then the information will be there. So, you need
> to show
> us what you are doing. My guess is that the data stored is
> null.
> But, without seeing your code, I cannot tell for sure.
>
> Jack
>
> --
> "You can lead a horse to water but you cannot make it float on
> its back."
> "Heaven has changed. The Sky now goes all the way to our
> feet.
>
> ~Dakota Jack~
>
> "This message may contain confidential and/or privileged
> information.
> If you are not the addressee or authorized to receive this for
> the
> addressee, you must not use, copy, disclose, or take any
> action based
> on this message or any information herein. If you have
> received this
> message in error, please advise the sender immediately by
> reply e-mail
> and delete this message. Thank you for your cooperation."
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
=====
Norris Shelton
Software Engineer
Sun Certified Java 1.1 Programmer
Appriss, Inc.
ICQ# 26487421
AIM NorrisEShelton
YIM norrisshelton
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]