Re: Extending DynaValidatorForm

2002-10-14 Thread Jan Fetyko

  Understood, however the problem I'm facing is that I have an ArrayList 
of Objects that I'd like to pass to the "EditProd" form , within this 
form the Method would create a String separated by some delimiter. This 
value would be then passed to the JSP to store in a field. Eventualy the 
"EditProd" form would read this field again and create the ArrayList 
back from the String.

I also iterate through this ArrayList on the JSP page.

Makes sense ?

This could be maybe solved by some JSP tag that'd create an ArrayList 
(or something I can iterate through) from a delimited String on the JSP 
page itself.

Maybe I'm doing it completely wrong, I even did try to use String[] in :



but that doesn't do any good.


J


Craig R. McClanahan wrote:

On Fri, 11 Oct 2002, Jan Fetyko wrote:



Date: Fri, 11 Oct 2002 07:47:20 -0400
From: Jan Fetyko <[EMAIL PROTECTED]>
Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
To: struts <[EMAIL PROTECTED]>
Subject: Extending DynaValidatorForm

Hi all,

I've got a little confusion going on. I wanted to extend the
"DynaValidatorForm" like this :

public class EditProd extends
org.apache.struts.validator.DynaValidatorForm {

 private String cats;

 public String getCats() {
 return cats;
 }

...
}

In the struts-config.xml I have defined few "fields" for the form :



 ...


but the form (JSP page) throws an error , cause it cannot find the
Getter for "cats". If I leave the "cats" out of the JSP page then it
works fine, so the dynamicaly generated getters work fine. How do I
access those Getters and Setters for "cats"?
Is it possible at all ?




If you are using DynaActionForm or DynaValidatorForm, you do *not* need to
create methods in your form bean class itself -- you only need to declare
them in struts-config as  elements.  So, you'd want to add:

   

You can then interact with those properties from your business logic, if
necessary, using either PropertyUtils:

   EditProd form = ...;
   String cats = (String) PropertyUtils.getSimpleProperty(form, "cats");

or directly using the underlying DynaBean APIs (DynaValidatorForm
ultimately inherits from org.apache.commons.beanutils.DynaBean):

   EditProd form = ...;
   String cats = (String) form.get("cats");



J



Craig


--
To unsubscribe, e-mail: 
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: 
<mailto:[EMAIL PROTECTED]>




Craig R. McClanahan wrote:

On Fri, 11 Oct 2002, Jan Fetyko wrote:



Date: Fri, 11 Oct 2002 07:47:20 -0400
From: Jan Fetyko <[EMAIL PROTECTED]>
Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
To: struts <[EMAIL PROTECTED]>
Subject: Extending DynaValidatorForm

Hi all,

I've got a little confusion going on. I wanted to extend the
"DynaValidatorForm" like this :

public class EditProd extends
org.apache.struts.validator.DynaValidatorForm {

 private String cats;

 public String getCats() {
 return cats;
 }

...
}

In the struts-config.xml I have defined few "fields" for the form :



 ...


but the form (JSP page) throws an error , cause it cannot find the
Getter for "cats". If I leave the "cats" out of the JSP page then it
works fine, so the dynamicaly generated getters work fine. How do I
access those Getters and Setters for "cats"?
Is it possible at all ?




If you are using DynaActionForm or DynaValidatorForm, you do *not* need to
create methods in your form bean class itself -- you only need to declare
them in struts-config as  elements.  So, you'd want to add:

   

You can then interact with those properties from your business logic, if
necessary, using either PropertyUtils:

   EditProd form = ...;
   String cats = (String) PropertyUtils.getSimpleProperty(form, "cats");

or directly using the underlying DynaBean APIs (DynaValidatorForm
ultimately inherits from org.apache.commons.beanutils.DynaBean):

   EditProd form = ...;
   String cats = (String) form.get("cats");



J



Craig


--
To unsubscribe, e-mail: 
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: 
<mailto:[EMAIL PROTECTED]>






--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Extending DynaValidatorForm

2002-10-11 Thread Craig R. McClanahan



On Fri, 11 Oct 2002, Jan Fetyko wrote:

> Date: Fri, 11 Oct 2002 07:47:20 -0400
> From: Jan Fetyko <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: struts <[EMAIL PROTECTED]>
> Subject: Extending DynaValidatorForm
>
> Hi all,
>
> I've got a little confusion going on. I wanted to extend the
> "DynaValidatorForm" like this :
>
> public class EditProd extends
> org.apache.struts.validator.DynaValidatorForm {
>
> private String cats;
>
> public String getCats() {
> return cats;
> }
>
> ...
> }
>
> In the struts-config.xml I have defined few "fields" for the form :
>
> 
>
> ...
> 
>
> but the form (JSP page) throws an error , cause it cannot find the
> Getter for "cats". If I leave the "cats" out of the JSP page then it
> works fine, so the dynamicaly generated getters work fine. How do I
> access those Getters and Setters for "cats"?
> Is it possible at all ?
>

If you are using DynaActionForm or DynaValidatorForm, you do *not* need to
create methods in your form bean class itself -- you only need to declare
them in struts-config as  elements.  So, you'd want to add:

  

You can then interact with those properties from your business logic, if
necessary, using either PropertyUtils:

  EditProd form = ...;
  String cats = (String) PropertyUtils.getSimpleProperty(form, "cats");

or directly using the underlying DynaBean APIs (DynaValidatorForm
ultimately inherits from org.apache.commons.beanutils.DynaBean):

  EditProd form = ...;
  String cats = (String) form.get("cats");

> J

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Extending DynaValidatorForm

2002-10-11 Thread Jan Fetyko

Hi all,

I've got a little confusion going on. I wanted to extend the 
"DynaValidatorForm" like this :

public class EditProd extends 
org.apache.struts.validator.DynaValidatorForm {

private String cats;

public String getCats() {
return cats;
}

...
}

In the struts-config.xml I have defined few "fields" for the form :


   
...


but the form (JSP page) throws an error , cause it cannot find the 
Getter for "cats". If I leave the "cats" out of the JSP page then it 
works fine, so the dynamicaly generated getters work fine. How do I 
access those Getters and Setters for "cats"?
Is it possible at all ?

J


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




RE: NullPointerException while extending DynaValidatorForm

2002-09-11 Thread Robert Taylor

Define a "set up" action mapping which is called prior to displaying your
page.



  



In the corresponding Action class for the mapping do the following:
public ActionForward execute(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
throws Exception {

DynaBean bean = (DynaBean) form;
Customer customer = // get customer somehow

bean.set("cid", customer.getCid());

return mapping.findForward("success");

}


When Struts encounters the /showSomePage it will create the form, invoke
SomeAction (which will populate the form), and then forward to somePage.jsp
where the form will reside in the request scope.

HTH,

robert

> -Original Message-
> From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 11, 2002 7:45 AM
> To: Struts Users Mailing List
> Subject: Re: NullPointerException while extending DynaValidatorForm
>
>
> How do I allow Struts to create the form ?
> Sorry, but I'm lost here ( and there :(( ).
>
> Jf
>
> Robert Taylor wrote:
>
> >Depending on which version of Struts you are using, you may
> >need to set the dynamic attribute of the form-bean element to "true".
> >
> >I'm assuming you are explicitely creating the form to convey that
> >the NPE is not because the form is null. If this is not the case,
> >you should allow Struts to create the form.
> >
> >robert
> >
> >
> >
> >
> >>-Original Message-
> >>From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
> >>Sent: Tuesday, September 10, 2002 11:32 AM
> >>To: struts
> >>Subject: Re: NullPointerException while extending DynaValidatorForm
> >>
> >>
> >>Looks like nobody has a recommendation on how to resolve issue described
> >>below ( at least till now).
> >>Is this working at all OR is this still a bug in the Beta version ?
> >>So, should I stick with the "old" forms for now ?
> >>
> >>Jf
> >>
> >>
> -
> >>
> >>
> >>
> >>>Hi all,
> >>>
> >>>I have a problem setting values of a form in my action.
> >>>The form extends the "org.apache.struts.validator.DynaValidatorForm".
> >>>The struts-config.xml defines all the properties of the form except 2,
> >>>that are defined in the actual Java source of the form.
> >>>
> >>>This is the error I'm getting :
> >>>
> >>>java.lang.NullPointerException
> >>>at
> >>>
> >>>
> >>>
> >>org.apache.struts.action.DynaActionForm.getDynaProperty(DynaAction
> >>Form.java:551)
> >>
> >>
> >>>
> >>>In struts config I have :
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>The action is trying to set the property of the form :
> >>>
> >>>form = new CustomerForm();
> >>>CustomerForm cf = (CustomerForm) form;
> >>>cf.set("cid", customer.getCid()); // THIS iS WHERE IT ERRORS OUT.
> >>>
> >>>
> >>>
> >>>Any ideas what I'm doing wrong ?
> >>>
> >>>Jf
> >>>
> >>>
> >>>
> >>--
> >>To unsubscribe, e-mail:
> >>
> >>
> ><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >
> >
> >--
> >To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>
>
>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: NullPointerException while extending DynaValidatorForm

2002-09-11 Thread Jan Fetyko

How do I allow Struts to create the form ?
Sorry, but I'm lost here ( and there :(( ).

Jf

Robert Taylor wrote:

>Depending on which version of Struts you are using, you may
>need to set the dynamic attribute of the form-bean element to "true".
>
>I'm assuming you are explicitely creating the form to convey that
>the NPE is not because the form is null. If this is not the case,
>you should allow Struts to create the form.
>
>robert
>
>
>  
>
>>-Original Message-
>>From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, September 10, 2002 11:32 AM
>>To: struts
>>Subject: Re: NullPointerException while extending DynaValidatorForm
>>
>>
>>Looks like nobody has a recommendation on how to resolve issue described
>>below ( at least till now).
>>Is this working at all OR is this still a bug in the Beta version ?
>>So, should I stick with the "old" forms for now ?
>>
>>Jf
>>
>>-
>>
>>
>>
>>>Hi all,
>>>
>>>I have a problem setting values of a form in my action.
>>>The form extends the "org.apache.struts.validator.DynaValidatorForm".
>>>The struts-config.xml defines all the properties of the form except 2,
>>>that are defined in the actual Java source of the form.
>>>
>>>This is the error I'm getting :
>>>
>>>java.lang.NullPointerException
>>>at
>>>
>>>  
>>>
>>org.apache.struts.action.DynaActionForm.getDynaProperty(DynaAction
>>Form.java:551)
>>
>>
>>>
>>>In struts config I have :
>>>
>>>
>>>
>>>
>>>
>>>The action is trying to set the property of the form :
>>>
>>>form = new CustomerForm();
>>>CustomerForm cf = (CustomerForm) form;
>>>cf.set("cid", customer.getCid()); // THIS iS WHERE IT ERRORS OUT.
>>>
>>>
>>>
>>>Any ideas what I'm doing wrong ?
>>>
>>>Jf
>>>
>>>  
>>>
>>--
>>To unsubscribe, e-mail:
>>
>>
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>  
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: NullPointerException while extending DynaValidatorForm

2002-09-11 Thread Robert Taylor

Depending on which version of Struts you are using, you may
need to set the dynamic attribute of the form-bean element to "true".

I'm assuming you are explicitely creating the form to convey that
the NPE is not because the form is null. If this is not the case,
you should allow Struts to create the form.

robert


> -Original Message-
> From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 10, 2002 11:32 AM
> To: struts
> Subject: Re: NullPointerException while extending DynaValidatorForm
>
>
> Looks like nobody has a recommendation on how to resolve issue described
> below ( at least till now).
> Is this working at all OR is this still a bug in the Beta version ?
> So, should I stick with the "old" forms for now ?
>
> Jf
>
> -
>
> > Hi all,
> >
> > I have a problem setting values of a form in my action.
> > The form extends the "org.apache.struts.validator.DynaValidatorForm".
> > The struts-config.xml defines all the properties of the form except 2,
> > that are defined in the actual Java source of the form.
> >
> > This is the error I'm getting :
> >
> > java.lang.NullPointerException
> > at
> >
> org.apache.struts.action.DynaActionForm.getDynaProperty(DynaAction
> Form.java:551)
> >
> >
> >
> > In struts config I have :
> >
> > 
> > 
> > 
> >
> > The action is trying to set the property of the form :
> >
> > form = new CustomerForm();
> > CustomerForm cf = (CustomerForm) form;
> > cf.set("cid", customer.getCid()); // THIS iS WHERE IT ERRORS OUT.
> >
> >
> >
> > Any ideas what I'm doing wrong ?
> >
> > Jf
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: NullPointerException while extending DynaValidatorForm

2002-09-10 Thread micael

You are not initializing a variable for an object.  I know that is rather 
obvious, but sometimes the obvious helps.  I hope it does here.

At 09:53 AM 9/10/2002 -0400, you wrote:
>Hi all,
>
>I have a problem setting values of a form in my action.
>The form extends the "org.apache.struts.validator.DynaValidatorForm". The 
>struts-config.xml defines all the properties of the form except 2, that 
>are defined in the actual Java source of the form.
>
>This is the error I'm getting :
>
>java.lang.NullPointerException
> at 
> org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:551)
>
>
>In struts config I have :
>
>
>
>
>
>The action is trying to set the property of the form :
>
>form = new CustomerForm();
>CustomerForm cf = (CustomerForm) form;
>cf.set("cid", customer.getCid()); // THIS iS WHERE IT ERRORS OUT.
>
>
>
>Any ideas what I'm doing wrong ?
>
>Jf
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>



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




Re: NullPointerException while extending DynaValidatorForm

2002-09-10 Thread Jan Fetyko

Looks like nobody has a recommendation on how to resolve issue described 
below ( at least till now).
Is this working at all OR is this still a bug in the Beta version ?
So, should I stick with the "old" forms for now ?

Jf

-

> Hi all,
>
> I have a problem setting values of a form in my action.
> The form extends the "org.apache.struts.validator.DynaValidatorForm". 
> The struts-config.xml defines all the properties of the form except 2, 
> that are defined in the actual Java source of the form.
>
> This is the error I'm getting :
>
> java.lang.NullPointerException
> at 
> org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:551) 
>
>
>
> In struts config I have :
>
> 
> 
> 
>
> The action is trying to set the property of the form :
>
> form = new CustomerForm();
> CustomerForm cf = (CustomerForm) form;
> cf.set("cid", customer.getCid()); // THIS iS WHERE IT ERRORS OUT.
>
>
>
> Any ideas what I'm doing wrong ?
>
> Jf
>


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




NullPointerException while extending DynaValidatorForm

2002-09-10 Thread Jan Fetyko

Hi all,

I have a problem setting values of a form in my action.
The form extends the "org.apache.struts.validator.DynaValidatorForm". 
The struts-config.xml defines all the properties of the form except 2, 
that are defined in the actual Java source of the form.

This is the error I'm getting :

java.lang.NullPointerException
at 
org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:551)


In struts config I have :





The action is trying to set the property of the form :

form = new CustomerForm();
CustomerForm cf = (CustomerForm) form;
cf.set("cid", customer.getCid()); // THIS iS WHERE IT ERRORS OUT.



Any ideas what I'm doing wrong ?

Jf


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