You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marco Mistroni <mm...@waersystems.com> on 2003/12/17 17:10:16 UTC

validation and DynaActionForm

Hi all,
	I am experiencing problems with DynaActionForm..
I have a DynaActionForm that contains 13 properties and
A DispatchAction used calling different methods depending
On the value of one parameter (named methodToCall).

Now, when I enter the page for the first time the only request
Parameter is 'methodToCall' since when I enter the page I need to
Remove some values that were with session scope.

The problem is that when I enter page for the first time I receive 
Following exception:

2/03 16:04:21:963 GMT] 51272c9d WebGroup      E SRVE0026E: [Servlet
Error]-[action]: java.lang.NullPointerException
	at org.apache.commons.validator.Validator.validate(Unknown
Source)
	at
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm
.java:303)
	at
org.apache.struts.action.RequestProcessor.processValidate(RequestProcess
or.java:893)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
247)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
	at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


Now, since it is a NullPointerException and it is raised by the
validate, my assumption is that the DynaValidatorForm is trying to
validate all the parameters in order to populate the Form, and since the
only parameter in the request is methodToCall, it raises an exception.

But, since I am no expert in DynaActionForm, can anyone help me out in
Solving my problem?

Thanx in advance and regards
	marco




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


Re: validation and DynaActionForm / concrete question

Posted by Mark Lowe <ma...@talk21.com>.
Hi marco

well i think the problem your having is because you're using a dispatch 
action

so the form is mapped to the action and its set to validate. You can 
either separte yu dispatch actions into standard actions or hack it by 
having a single action that calls your dispatch action much like you 
were suggesting doing with jsp.

Cheers Mark

On 17 Dec 2003, at 16:35, Marco Mistroni wrote:

> Hi all,
> 	After struggling with my application, I have
> One question to ask.
> I have a DispatchAction class that handles my logic, and
> A DynaActionForm associated with it.
> The problem is that the jsp from which the request comes can
> Contain either 1, 2 parameters (out of 13 of DynaActionForm) or
> 13/13 parameters, since the page presents different information
> depending
> on which task I have to perform (either a search or an update or
> delete).
> Now, I keep on getting ValidationException when I have only 2 
> parameters
> In my DynaActionForm I have 9 Strings, 2 BigDecimal, 1 Short and 1
> Timestamp.
>
> Am I receiving the exception (listed below) because Struts is trying to
> validate all the input parameters? If that is true, is It worth to use
> DynaActionForm when I don't have all the parameters supplied from jsp?
>
> Or, how do I have to proceed?
>
> Anyone has any suggestions?
>
> Thanx and regards
> 	Marco
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


RE: validation and DynaActionForm / concrete question

Posted by Marco Mistroni <mm...@waersystems.com>.
Hi all,
	After struggling with my application, I have
One question to ask.
I have a DispatchAction class that handles my logic, and
A DynaActionForm associated with it.
The problem is that the jsp from which the request comes can
Contain either 1, 2 parameters (out of 13 of DynaActionForm) or
13/13 parameters, since the page presents different information
depending
on which task I have to perform (either a search or an update or
delete).
Now, I keep on getting ValidationException when I have only 2 parameters
In my DynaActionForm I have 9 Strings, 2 BigDecimal, 1 Short and 1
Timestamp.

Am I receiving the exception (listed below) because Struts is trying to
validate all the input parameters? If that is true, is It worth to use
DynaActionForm when I don't have all the parameters supplied from jsp?

Or, how do I have to proceed? 

Anyone has any suggestions?

Thanx and regards
	Marco




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


RE: validation and DynaActionForm

Posted by Marco Mistroni <mm...@waersystems.com>.
Hi Mark,
	Thanx.. but this

<A href="/myaction.do?methodToCall=foo">..</a>

is exactly what I am doing..

I am assuming that If validator is trying to validate all the
Parameters I have no other choice than redirect straight to the
Jsp...........

Thanx anyway and regards
	marco




On 17 Dec 2003, at 16:10, Marco Mistroni wrote:

> Hi all,
> 	I am experiencing problems with DynaActionForm..
> I have a DynaActionForm that contains 13 properties and
> A DispatchAction used calling different methods depending
> On the value of one parameter (named methodToCall).
>
> Now, when I enter the page for the first time the only request
> Parameter is 'methodToCall' since when I enter the page I need to
> Remove some values that were with session scope.
>
> The problem is that when I enter page for the first time I receive
> Following exception:
>
> 2/03 16:04:21:963 GMT] 51272c9d WebGroup      E SRVE0026E: [Servlet
> Error]-[action]: java.lang.NullPointerException
> 	at org.apache.commons.validator.Validator.validate(Unknown
> Source)
> 	at
>
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorFor 
> m
> .java:303)
> 	at
>
org.apache.struts.action.RequestProcessor.processValidate(RequestProces 
> s
> or.java:893)
> 	at
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java 
> :
> 247)
> 	at
>
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
> 	at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
>
> Now, since it is a NullPointerException and it is raised by the
> validate, my assumption is that the DynaValidatorForm is trying to
> validate all the parameters in order to populate the Form, and since  
> the
> only parameter in the request is methodToCall, it raises an exception.
>
> But, since I am no expert in DynaActionForm, can anyone help me out in
> Solving my problem?
>
> Thanx in advance and regards
> 	marco
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


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


Re: validation and DynaActionForm

Posted by Mark Lowe <ma...@talk21.com>.
Hi Marco

Perhaps try a none strust form element

<input type="hidden" name="methodToCall" value="foo">

rather than

<html:hidden property="methodToCall" value="foo" />

also if possible in your situation

<html:form action="/myaction.do?methodToCall=foo">

Cheers Mark


On 17 Dec 2003, at 16:10, Marco Mistroni wrote:

> Hi all,
> 	I am experiencing problems with DynaActionForm..
> I have a DynaActionForm that contains 13 properties and
> A DispatchAction used calling different methods depending
> On the value of one parameter (named methodToCall).
>
> Now, when I enter the page for the first time the only request
> Parameter is 'methodToCall' since when I enter the page I need to
> Remove some values that were with session scope.
>
> The problem is that when I enter page for the first time I receive
> Following exception:
>
> 2/03 16:04:21:963 GMT] 51272c9d WebGroup      E SRVE0026E: [Servlet
> Error]-[action]: java.lang.NullPointerException
> 	at org.apache.commons.validator.Validator.validate(Unknown
> Source)
> 	at
> org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorFor 
> m
> .java:303)
> 	at
> org.apache.struts.action.RequestProcessor.processValidate(RequestProces 
> s
> or.java:893)
> 	at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java 
> :
> 247)
> 	at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
> 	at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
>
> Now, since it is a NullPointerException and it is raised by the
> validate, my assumption is that the DynaValidatorForm is trying to
> validate all the parameters in order to populate the Form, and since  
> the
> only parameter in the request is methodToCall, it raises an exception.
>
> But, since I am no expert in DynaActionForm, can anyone help me out in
> Solving my problem?
>
> Thanx in advance and regards
> 	marco
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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