You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by 928572663 <92...@cox.net> on 2008/10/21 17:01:57 UTC

[s2] Problem getting basic server side field validation to work

I'm trying to do a very basic test app that demonstrates the server side 
field validation and am getting an exception during initial JSP page 
rendering.  The page and action work fine without the validation.

Any ideas what I may be missing?

I've read the confluence pages on validation, and have been keeping up 
with the many posts on the mailing list, but they all seem to be various 
advanced scenarios.

Here is some info to help:

* Using struts 2.1.2 basic (no plugins to speak of)
* Using Zero Configuration (annotations) with no struts.xml
* form bean is stored in session
* action function works great w/o validation
* when adding the SampleAction-validation.xml the exception happens 
during initial page rendering

Here is the stack and last few logs:


DEBUG [] [2008/10/21 09:01:12] 
[com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] 
Invoking validate() on action sample.SampleAction@17cad35
DEBUG [] [2008/10/21 09:01:12] 
[com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil] cannot 
find method [validateDisplayForm] in action [sample.SampleAction@17cad35]
DEBUG [] [2008/10/21 09:01:12] 
[com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil] cannot 
find method [validateDoDisplayForm] in action [sample.SampleAction@17cad35]
DEBUG [] [2008/10/21 09:01:12] 
[com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] Errors 
on action sample.SampleAction@17cad35, returning result name 'input'
ERROR [] [2008/10/21 09:01:12] 
[org.apache.struts2.dispatcher.Dispatcher] Could not find action or 
result No result defined for action sample.SampleAction and result input
         at 
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:357)
         at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259)
         at 
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:248)
         at 
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
         at 
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)



/SampleAction-validation.xml

<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 
1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
    <field name="formBean.lastName">
       <field-validator type="requiredstring">
          <message>You must enter a Last Name</message>
       </field-validator>
    </field>
    <field name="formBean.maxValue">
       <field-validator type="int">
          <param name="min">13</param>
          <param name="max">19</param>
          <message>The max value must be between 13 and 19</message>
       </field-validator>
    </field>
</validators>


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


Re: [s2] Problem getting basic server side field validation to work

Posted by 928572663 <92...@cox.net>.
David,

Yeah I had read the wildcard-mappings.html  link, but it just isn't 
clear to me how this would work:

    1. I'm using annotation-based action definitions (no struts.xml) so 
I'm not explicitly declaring the action name.
    2. When invoking my actions, I'm using the method form of the calls, 
ex. sample!next,  sample!back,  sample!doSomething    and those methods 
determine which result would normally be returned.

My real application is going to need to be much more flexible, and 
cannot be so statically defined as it seems it would need to be to work 
with the wildcard mapping.

All I really want to happen is for the ValidationInterceptor to return 
me to the page that was displayed if there is a validation error (and 
show the field messages) so the user can correct their mistakes.

Is there a way that I can override the definition of the "input" results 
to return a different JSP page each time a method is invoked, or is 
there a way to extend the ValidationInterceptor so that it can 
dynamically figure out what page was submitted?

Thanks,
John


Kawczynski, David wrote:
> The action-per-jsp page is just one way to do things.  Another is to use
> wildcard actions in your struts.xml page.  Your input pages would all
> have to employ the same naming convention, as would the actions called
> by each of those pages.  Check out the wildcard-mappings link and you'll
> see what I mean.
> http://struts.apache.org/2.0.11.2/docs/wildcard-mappings.html
> 
> -----Original Message-----
> From: 928572663 [mailto:928572663@cox.net] 
> Sent: Tuesday, October 21, 2008 12:14 PM
> To: Struts Users Mailing List
> Subject: Re: [s2] Problem getting basic server side field validation to
> work
> 
> Thanks David.
> 
> So are you saying that the struts2 validation framework requires one 
> Action per JSP page?   If so, it seems like that needs to be included in
> 
> the "full disclosure" section of the "validation" confluence page  :-)
> 
> If I don't want to go that route (1 Action : 1 JSP),  are there any 
> alternatives short of writing my own validation framework?
> 
> Thanks,
> John
> 
> 
> Kawczynski, David wrote:
>> Either have lots of actions in your struts.xml, or use wildcard
> mappings
>> (http://struts.apache.org/2.0.11.2/docs/wildcard-mappings.html)
>>
>> -----Original Message-----
>> From: 928572663 [mailto:928572663@cox.net] 
>> Sent: Tuesday, October 21, 2008 11:43 AM
>> To: Struts Users Mailing List
>> Subject: Re: [s2] Problem getting basic server side field validation
> to
>> work
>>
>> Great - that fixed it.
>>
>> Follow up:  supposed this Action class can serve up 10 different JSP 
>> pages, all of which need validation.   I would want the "input" result
> 
>> type to forward to whichever of the 10 JSPs that the user was in when 
>> the validation error occurred.   So what is the best way to handle
> that?
>> Thanks,
>> John
>>
>>
>> Kawczynski, David wrote:
>>> Yes, in the event of server-sided validation failure the framework
>>> returns the user to this "input" page 
>>>
>>> -----Original Message-----
>>> From: 928572663 [mailto:928572663@cox.net] 
>>> Sent: Tuesday, October 21, 2008 11:27 AM
>>> To: Kawczynski, David
>>> Cc: Struts Users Mailing List
>>> Subject: Re: [s2] Problem getting basic server side field validation
>> to
>>> work
>>>
>>> Thanks David for the quick reply.
>>>
>>> Is the 'input' result type used by the validation framework?  My
>> action 
>>> class does not return that.
>>>
>>> Thanks,
>>> John
>>>
>>>
>>> Kawczynski, David wrote:
>>>> You need to define a <result> of type input for your action. 
>>>>
>>>> -----Original Message-----
>>>> From: 928572663 [mailto:928572663@cox.net] 
>>>> Sent: Tuesday, October 21, 2008 11:02 AM
>>>> To: Struts Users Mailing List
>>>> Subject: [s2] Problem getting basic server side field validation to
>>> work
>>>> I'm trying to do a very basic test app that demonstrates the server
>>> side
>>>> field validation and am getting an exception during initial JSP page
> 
>>>> rendering.  The page and action work fine without the validation.
>>>>
>>>> Any ideas what I may be missing?
>>>>
>>>> I've read the confluence pages on validation, and have been keeping
>> up
>>>> with the many posts on the mailing list, but they all seem to be
>>> various
>>>> advanced scenarios.
>>>>
>>>> Here is some info to help:
>>>>
>>>> * Using struts 2.1.2 basic (no plugins to speak of)
>>>> * Using Zero Configuration (annotations) with no struts.xml
>>>> * form bean is stored in session
>>>> * action function works great w/o validation
>>>> * when adding the SampleAction-validation.xml the exception happens 
>>>> during initial page rendering
>>>>
>>>> Here is the stack and last few logs:
>>>>
>>>>
>>>> DEBUG [] [2008/10/21 09:01:12] 
>>>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] 
>>>> Invoking validate() on action sample.SampleAction@17cad35
>>>> DEBUG [] [2008/10/21 09:01:12] 
>>>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
>>> cannot 
>>>> find method [validateDisplayForm] in action
>>>> [sample.SampleAction@17cad35]
>>>> DEBUG [] [2008/10/21 09:01:12] 
>>>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
>>> cannot 
>>>> find method [validateDoDisplayForm] in action
>>>> [sample.SampleAction@17cad35]
>>>> DEBUG [] [2008/10/21 09:01:12] 
>>>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor]
>>> Errors 
>>>> on action sample.SampleAction@17cad35, returning result name 'input'
>>>> ERROR [] [2008/10/21 09:01:12] 
>>>> [org.apache.struts2.dispatcher.Dispatcher] Could not find action or 
>>>> result No result defined for action sample.SampleAction and result
>>> input
>>>>          at 
>>>>
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
>>>> ionInvocation.java:357)
>>>>          at 
>>>>
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
>>>> cation.java:259)
>>>>          at 
>>>>
> com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Vali
>>>> dationInterceptor.java:248)
>>>>          at 
>>>>
> org.apache.struts2.interceptor.validation.AnnotationValidationIntercepto
>>>> r.doIntercept(AnnotationValidationInterceptor.java:49)
>>>>          at 
>>>>
> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Me
>>>> thodFilterInterceptor.java:86)
>>>>
>>>>
>>>>
>>>> /SampleAction-validation.xml
>>>>
>>>> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 
>>>> 1.0.2//EN"
>>>> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
>>>> <validators>
>>>>     <field name="formBean.lastName">
>>>>        <field-validator type="requiredstring">
>>>>           <message>You must enter a Last Name</message>
>>>>        </field-validator>
>>>>     </field>
>>>>     <field name="formBean.maxValue">
>>>>        <field-validator type="int">
>>>>           <param name="min">13</param>
>>>>           <param name="max">19</param>
>>>>           <message>The max value must be between 13 and 19</message>
>>>>        </field-validator>
>>>>     </field>
>>>> </validators>
>>>>
>>>>

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


RE: [s2] Problem getting basic server side field validation to work

Posted by "Kawczynski, David" <da...@merck.com>.
The action-per-jsp page is just one way to do things.  Another is to use
wildcard actions in your struts.xml page.  Your input pages would all
have to employ the same naming convention, as would the actions called
by each of those pages.  Check out the wildcard-mappings link and you'll
see what I mean.
http://struts.apache.org/2.0.11.2/docs/wildcard-mappings.html

-----Original Message-----
From: 928572663 [mailto:928572663@cox.net] 
Sent: Tuesday, October 21, 2008 12:14 PM
To: Struts Users Mailing List
Subject: Re: [s2] Problem getting basic server side field validation to
work

Thanks David.

So are you saying that the struts2 validation framework requires one 
Action per JSP page?   If so, it seems like that needs to be included in

the "full disclosure" section of the "validation" confluence page  :-)

If I don't want to go that route (1 Action : 1 JSP),  are there any 
alternatives short of writing my own validation framework?

Thanks,
John


Kawczynski, David wrote:
> Either have lots of actions in your struts.xml, or use wildcard
mappings
> (http://struts.apache.org/2.0.11.2/docs/wildcard-mappings.html)
> 
> -----Original Message-----
> From: 928572663 [mailto:928572663@cox.net] 
> Sent: Tuesday, October 21, 2008 11:43 AM
> To: Struts Users Mailing List
> Subject: Re: [s2] Problem getting basic server side field validation
to
> work
> 
> Great - that fixed it.
> 
> Follow up:  supposed this Action class can serve up 10 different JSP 
> pages, all of which need validation.   I would want the "input" result

> type to forward to whichever of the 10 JSPs that the user was in when 
> the validation error occurred.   So what is the best way to handle
that?
> 
> Thanks,
> John
> 
> 
> Kawczynski, David wrote:
>> Yes, in the event of server-sided validation failure the framework
>> returns the user to this "input" page 
>>
>> -----Original Message-----
>> From: 928572663 [mailto:928572663@cox.net] 
>> Sent: Tuesday, October 21, 2008 11:27 AM
>> To: Kawczynski, David
>> Cc: Struts Users Mailing List
>> Subject: Re: [s2] Problem getting basic server side field validation
> to
>> work
>>
>> Thanks David for the quick reply.
>>
>> Is the 'input' result type used by the validation framework?  My
> action 
>> class does not return that.
>>
>> Thanks,
>> John
>>
>>
>> Kawczynski, David wrote:
>>> You need to define a <result> of type input for your action. 
>>>
>>> -----Original Message-----
>>> From: 928572663 [mailto:928572663@cox.net] 
>>> Sent: Tuesday, October 21, 2008 11:02 AM
>>> To: Struts Users Mailing List
>>> Subject: [s2] Problem getting basic server side field validation to
>> work
>>> I'm trying to do a very basic test app that demonstrates the server
>> side
>>> field validation and am getting an exception during initial JSP page

>>> rendering.  The page and action work fine without the validation.
>>>
>>> Any ideas what I may be missing?
>>>
>>> I've read the confluence pages on validation, and have been keeping
> up
>>> with the many posts on the mailing list, but they all seem to be
>> various
>>> advanced scenarios.
>>>
>>> Here is some info to help:
>>>
>>> * Using struts 2.1.2 basic (no plugins to speak of)
>>> * Using Zero Configuration (annotations) with no struts.xml
>>> * form bean is stored in session
>>> * action function works great w/o validation
>>> * when adding the SampleAction-validation.xml the exception happens 
>>> during initial page rendering
>>>
>>> Here is the stack and last few logs:
>>>
>>>
>>> DEBUG [] [2008/10/21 09:01:12] 
>>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] 
>>> Invoking validate() on action sample.SampleAction@17cad35
>>> DEBUG [] [2008/10/21 09:01:12] 
>>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
>> cannot 
>>> find method [validateDisplayForm] in action
>>> [sample.SampleAction@17cad35]
>>> DEBUG [] [2008/10/21 09:01:12] 
>>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
>> cannot 
>>> find method [validateDoDisplayForm] in action
>>> [sample.SampleAction@17cad35]
>>> DEBUG [] [2008/10/21 09:01:12] 
>>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor]
>> Errors 
>>> on action sample.SampleAction@17cad35, returning result name 'input'
>>> ERROR [] [2008/10/21 09:01:12] 
>>> [org.apache.struts2.dispatcher.Dispatcher] Could not find action or 
>>> result No result defined for action sample.SampleAction and result
>> input
>>>          at 
>>>
>
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
>>> ionInvocation.java:357)
>>>          at 
>>>
>
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
>>> cation.java:259)
>>>          at 
>>>
>
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Vali
>>> dationInterceptor.java:248)
>>>          at 
>>>
>
org.apache.struts2.interceptor.validation.AnnotationValidationIntercepto
>>> r.doIntercept(AnnotationValidationInterceptor.java:49)
>>>          at 
>>>
>
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Me
>>> thodFilterInterceptor.java:86)
>>>
>>>
>>>
>>> /SampleAction-validation.xml
>>>
>>> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 
>>> 1.0.2//EN"
>>> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
>>> <validators>
>>>     <field name="formBean.lastName">
>>>        <field-validator type="requiredstring">
>>>           <message>You must enter a Last Name</message>
>>>        </field-validator>
>>>     </field>
>>>     <field name="formBean.maxValue">
>>>        <field-validator type="int">
>>>           <param name="min">13</param>
>>>           <param name="max">19</param>
>>>           <message>The max value must be between 13 and 19</message>
>>>        </field-validator>
>>>     </field>
>>> </validators>
>>>
>>>
> 

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

Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or
MSD and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and
then delete it from your system.


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


Re: [s2] Problem getting basic server side field validation to work

Posted by 928572663 <92...@cox.net>.
Thanks David.

So are you saying that the struts2 validation framework requires one 
Action per JSP page?   If so, it seems like that needs to be included in 
the "full disclosure" section of the "validation" confluence page  :-)

If I don't want to go that route (1 Action : 1 JSP),  are there any 
alternatives short of writing my own validation framework?

Thanks,
John


Kawczynski, David wrote:
> Either have lots of actions in your struts.xml, or use wildcard mappings
> (http://struts.apache.org/2.0.11.2/docs/wildcard-mappings.html)
> 
> -----Original Message-----
> From: 928572663 [mailto:928572663@cox.net] 
> Sent: Tuesday, October 21, 2008 11:43 AM
> To: Struts Users Mailing List
> Subject: Re: [s2] Problem getting basic server side field validation to
> work
> 
> Great - that fixed it.
> 
> Follow up:  supposed this Action class can serve up 10 different JSP 
> pages, all of which need validation.   I would want the "input" result 
> type to forward to whichever of the 10 JSPs that the user was in when 
> the validation error occurred.   So what is the best way to handle that?
> 
> Thanks,
> John
> 
> 
> Kawczynski, David wrote:
>> Yes, in the event of server-sided validation failure the framework
>> returns the user to this "input" page 
>>
>> -----Original Message-----
>> From: 928572663 [mailto:928572663@cox.net] 
>> Sent: Tuesday, October 21, 2008 11:27 AM
>> To: Kawczynski, David
>> Cc: Struts Users Mailing List
>> Subject: Re: [s2] Problem getting basic server side field validation
> to
>> work
>>
>> Thanks David for the quick reply.
>>
>> Is the 'input' result type used by the validation framework?  My
> action 
>> class does not return that.
>>
>> Thanks,
>> John
>>
>>
>> Kawczynski, David wrote:
>>> You need to define a <result> of type input for your action. 
>>>
>>> -----Original Message-----
>>> From: 928572663 [mailto:928572663@cox.net] 
>>> Sent: Tuesday, October 21, 2008 11:02 AM
>>> To: Struts Users Mailing List
>>> Subject: [s2] Problem getting basic server side field validation to
>> work
>>> I'm trying to do a very basic test app that demonstrates the server
>> side
>>> field validation and am getting an exception during initial JSP page 
>>> rendering.  The page and action work fine without the validation.
>>>
>>> Any ideas what I may be missing?
>>>
>>> I've read the confluence pages on validation, and have been keeping
> up
>>> with the many posts on the mailing list, but they all seem to be
>> various
>>> advanced scenarios.
>>>
>>> Here is some info to help:
>>>
>>> * Using struts 2.1.2 basic (no plugins to speak of)
>>> * Using Zero Configuration (annotations) with no struts.xml
>>> * form bean is stored in session
>>> * action function works great w/o validation
>>> * when adding the SampleAction-validation.xml the exception happens 
>>> during initial page rendering
>>>
>>> Here is the stack and last few logs:
>>>
>>>
>>> DEBUG [] [2008/10/21 09:01:12] 
>>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] 
>>> Invoking validate() on action sample.SampleAction@17cad35
>>> DEBUG [] [2008/10/21 09:01:12] 
>>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
>> cannot 
>>> find method [validateDisplayForm] in action
>>> [sample.SampleAction@17cad35]
>>> DEBUG [] [2008/10/21 09:01:12] 
>>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
>> cannot 
>>> find method [validateDoDisplayForm] in action
>>> [sample.SampleAction@17cad35]
>>> DEBUG [] [2008/10/21 09:01:12] 
>>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor]
>> Errors 
>>> on action sample.SampleAction@17cad35, returning result name 'input'
>>> ERROR [] [2008/10/21 09:01:12] 
>>> [org.apache.struts2.dispatcher.Dispatcher] Could not find action or 
>>> result No result defined for action sample.SampleAction and result
>> input
>>>          at 
>>>
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
>>> ionInvocation.java:357)
>>>          at 
>>>
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
>>> cation.java:259)
>>>          at 
>>>
> com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Vali
>>> dationInterceptor.java:248)
>>>          at 
>>>
> org.apache.struts2.interceptor.validation.AnnotationValidationIntercepto
>>> r.doIntercept(AnnotationValidationInterceptor.java:49)
>>>          at 
>>>
> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Me
>>> thodFilterInterceptor.java:86)
>>>
>>>
>>>
>>> /SampleAction-validation.xml
>>>
>>> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 
>>> 1.0.2//EN"
>>> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
>>> <validators>
>>>     <field name="formBean.lastName">
>>>        <field-validator type="requiredstring">
>>>           <message>You must enter a Last Name</message>
>>>        </field-validator>
>>>     </field>
>>>     <field name="formBean.maxValue">
>>>        <field-validator type="int">
>>>           <param name="min">13</param>
>>>           <param name="max">19</param>
>>>           <message>The max value must be between 13 and 19</message>
>>>        </field-validator>
>>>     </field>
>>> </validators>
>>>
>>>
> 

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


RE: [s2] Problem getting basic server side field validation to work

Posted by "Kawczynski, David" <da...@merck.com>.
Either have lots of actions in your struts.xml, or use wildcard mappings
(http://struts.apache.org/2.0.11.2/docs/wildcard-mappings.html)

-----Original Message-----
From: 928572663 [mailto:928572663@cox.net] 
Sent: Tuesday, October 21, 2008 11:43 AM
To: Struts Users Mailing List
Subject: Re: [s2] Problem getting basic server side field validation to
work

Great - that fixed it.

Follow up:  supposed this Action class can serve up 10 different JSP 
pages, all of which need validation.   I would want the "input" result 
type to forward to whichever of the 10 JSPs that the user was in when 
the validation error occurred.   So what is the best way to handle that?

Thanks,
John


Kawczynski, David wrote:
> Yes, in the event of server-sided validation failure the framework
> returns the user to this "input" page 
> 
> -----Original Message-----
> From: 928572663 [mailto:928572663@cox.net] 
> Sent: Tuesday, October 21, 2008 11:27 AM
> To: Kawczynski, David
> Cc: Struts Users Mailing List
> Subject: Re: [s2] Problem getting basic server side field validation
to
> work
> 
> Thanks David for the quick reply.
> 
> Is the 'input' result type used by the validation framework?  My
action 
> class does not return that.
> 
> Thanks,
> John
> 
> 
> Kawczynski, David wrote:
>> You need to define a <result> of type input for your action. 
>>
>> -----Original Message-----
>> From: 928572663 [mailto:928572663@cox.net] 
>> Sent: Tuesday, October 21, 2008 11:02 AM
>> To: Struts Users Mailing List
>> Subject: [s2] Problem getting basic server side field validation to
> work
>> I'm trying to do a very basic test app that demonstrates the server
> side
>> field validation and am getting an exception during initial JSP page 
>> rendering.  The page and action work fine without the validation.
>>
>> Any ideas what I may be missing?
>>
>> I've read the confluence pages on validation, and have been keeping
up
> 
>> with the many posts on the mailing list, but they all seem to be
> various
>> advanced scenarios.
>>
>> Here is some info to help:
>>
>> * Using struts 2.1.2 basic (no plugins to speak of)
>> * Using Zero Configuration (annotations) with no struts.xml
>> * form bean is stored in session
>> * action function works great w/o validation
>> * when adding the SampleAction-validation.xml the exception happens 
>> during initial page rendering
>>
>> Here is the stack and last few logs:
>>
>>
>> DEBUG [] [2008/10/21 09:01:12] 
>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] 
>> Invoking validate() on action sample.SampleAction@17cad35
>> DEBUG [] [2008/10/21 09:01:12] 
>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
> cannot 
>> find method [validateDisplayForm] in action
>> [sample.SampleAction@17cad35]
>> DEBUG [] [2008/10/21 09:01:12] 
>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
> cannot 
>> find method [validateDoDisplayForm] in action
>> [sample.SampleAction@17cad35]
>> DEBUG [] [2008/10/21 09:01:12] 
>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor]
> Errors 
>> on action sample.SampleAction@17cad35, returning result name 'input'
>> ERROR [] [2008/10/21 09:01:12] 
>> [org.apache.struts2.dispatcher.Dispatcher] Could not find action or 
>> result No result defined for action sample.SampleAction and result
> input
>>          at 
>>
>
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
>> ionInvocation.java:357)
>>          at 
>>
>
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
>> cation.java:259)
>>          at 
>>
>
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Vali
>> dationInterceptor.java:248)
>>          at 
>>
>
org.apache.struts2.interceptor.validation.AnnotationValidationIntercepto
>> r.doIntercept(AnnotationValidationInterceptor.java:49)
>>          at 
>>
>
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Me
>> thodFilterInterceptor.java:86)
>>
>>
>>
>> /SampleAction-validation.xml
>>
>> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 
>> 1.0.2//EN"
>> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
>> <validators>
>>     <field name="formBean.lastName">
>>        <field-validator type="requiredstring">
>>           <message>You must enter a Last Name</message>
>>        </field-validator>
>>     </field>
>>     <field name="formBean.maxValue">
>>        <field-validator type="int">
>>           <param name="min">13</param>
>>           <param name="max">19</param>
>>           <message>The max value must be between 13 and 19</message>
>>        </field-validator>
>>     </field>
>> </validators>
>>
>>

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

Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or
MSD and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and
then delete it from your system.


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


Re: [s2] Problem getting basic server side field validation to work

Posted by 928572663 <92...@cox.net>.
Great - that fixed it.

Follow up:  supposed this Action class can serve up 10 different JSP 
pages, all of which need validation.   I would want the "input" result 
type to forward to whichever of the 10 JSPs that the user was in when 
the validation error occurred.   So what is the best way to handle that?

Thanks,
John


Kawczynski, David wrote:
> Yes, in the event of server-sided validation failure the framework
> returns the user to this "input" page 
> 
> -----Original Message-----
> From: 928572663 [mailto:928572663@cox.net] 
> Sent: Tuesday, October 21, 2008 11:27 AM
> To: Kawczynski, David
> Cc: Struts Users Mailing List
> Subject: Re: [s2] Problem getting basic server side field validation to
> work
> 
> Thanks David for the quick reply.
> 
> Is the 'input' result type used by the validation framework?  My action 
> class does not return that.
> 
> Thanks,
> John
> 
> 
> Kawczynski, David wrote:
>> You need to define a <result> of type input for your action. 
>>
>> -----Original Message-----
>> From: 928572663 [mailto:928572663@cox.net] 
>> Sent: Tuesday, October 21, 2008 11:02 AM
>> To: Struts Users Mailing List
>> Subject: [s2] Problem getting basic server side field validation to
> work
>> I'm trying to do a very basic test app that demonstrates the server
> side
>> field validation and am getting an exception during initial JSP page 
>> rendering.  The page and action work fine without the validation.
>>
>> Any ideas what I may be missing?
>>
>> I've read the confluence pages on validation, and have been keeping up
> 
>> with the many posts on the mailing list, but they all seem to be
> various
>> advanced scenarios.
>>
>> Here is some info to help:
>>
>> * Using struts 2.1.2 basic (no plugins to speak of)
>> * Using Zero Configuration (annotations) with no struts.xml
>> * form bean is stored in session
>> * action function works great w/o validation
>> * when adding the SampleAction-validation.xml the exception happens 
>> during initial page rendering
>>
>> Here is the stack and last few logs:
>>
>>
>> DEBUG [] [2008/10/21 09:01:12] 
>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] 
>> Invoking validate() on action sample.SampleAction@17cad35
>> DEBUG [] [2008/10/21 09:01:12] 
>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
> cannot 
>> find method [validateDisplayForm] in action
>> [sample.SampleAction@17cad35]
>> DEBUG [] [2008/10/21 09:01:12] 
>> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
> cannot 
>> find method [validateDoDisplayForm] in action
>> [sample.SampleAction@17cad35]
>> DEBUG [] [2008/10/21 09:01:12] 
>> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor]
> Errors 
>> on action sample.SampleAction@17cad35, returning result name 'input'
>> ERROR [] [2008/10/21 09:01:12] 
>> [org.apache.struts2.dispatcher.Dispatcher] Could not find action or 
>> result No result defined for action sample.SampleAction and result
> input
>>          at 
>>
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
>> ionInvocation.java:357)
>>          at 
>>
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
>> cation.java:259)
>>          at 
>>
> com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Vali
>> dationInterceptor.java:248)
>>          at 
>>
> org.apache.struts2.interceptor.validation.AnnotationValidationIntercepto
>> r.doIntercept(AnnotationValidationInterceptor.java:49)
>>          at 
>>
> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Me
>> thodFilterInterceptor.java:86)
>>
>>
>>
>> /SampleAction-validation.xml
>>
>> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 
>> 1.0.2//EN"
>> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
>> <validators>
>>     <field name="formBean.lastName">
>>        <field-validator type="requiredstring">
>>           <message>You must enter a Last Name</message>
>>        </field-validator>
>>     </field>
>>     <field name="formBean.maxValue">
>>        <field-validator type="int">
>>           <param name="min">13</param>
>>           <param name="max">19</param>
>>           <message>The max value must be between 13 and 19</message>
>>        </field-validator>
>>     </field>
>> </validators>
>>
>>

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


RE: [s2] Problem getting basic server side field validation to work

Posted by "Kawczynski, David" <da...@merck.com>.
Yes, in the event of server-sided validation failure the framework
returns the user to this "input" page 

-----Original Message-----
From: 928572663 [mailto:928572663@cox.net] 
Sent: Tuesday, October 21, 2008 11:27 AM
To: Kawczynski, David
Cc: Struts Users Mailing List
Subject: Re: [s2] Problem getting basic server side field validation to
work

Thanks David for the quick reply.

Is the 'input' result type used by the validation framework?  My action 
class does not return that.

Thanks,
John


Kawczynski, David wrote:
> You need to define a <result> of type input for your action. 
> 
> -----Original Message-----
> From: 928572663 [mailto:928572663@cox.net] 
> Sent: Tuesday, October 21, 2008 11:02 AM
> To: Struts Users Mailing List
> Subject: [s2] Problem getting basic server side field validation to
work
> 
> I'm trying to do a very basic test app that demonstrates the server
side
> 
> field validation and am getting an exception during initial JSP page 
> rendering.  The page and action work fine without the validation.
> 
> Any ideas what I may be missing?
> 
> I've read the confluence pages on validation, and have been keeping up

> with the many posts on the mailing list, but they all seem to be
various
> 
> advanced scenarios.
> 
> Here is some info to help:
> 
> * Using struts 2.1.2 basic (no plugins to speak of)
> * Using Zero Configuration (annotations) with no struts.xml
> * form bean is stored in session
> * action function works great w/o validation
> * when adding the SampleAction-validation.xml the exception happens 
> during initial page rendering
> 
> Here is the stack and last few logs:
> 
> 
> DEBUG [] [2008/10/21 09:01:12] 
> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] 
> Invoking validate() on action sample.SampleAction@17cad35
> DEBUG [] [2008/10/21 09:01:12] 
> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
cannot 
> find method [validateDisplayForm] in action
> [sample.SampleAction@17cad35]
> DEBUG [] [2008/10/21 09:01:12] 
> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil]
cannot 
> find method [validateDoDisplayForm] in action
> [sample.SampleAction@17cad35]
> DEBUG [] [2008/10/21 09:01:12] 
> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor]
Errors 
> on action sample.SampleAction@17cad35, returning result name 'input'
> ERROR [] [2008/10/21 09:01:12] 
> [org.apache.struts2.dispatcher.Dispatcher] Could not find action or 
> result No result defined for action sample.SampleAction and result
input
>          at 
>
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
> ionInvocation.java:357)
>          at 
>
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
> cation.java:259)
>          at 
>
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Vali
> dationInterceptor.java:248)
>          at 
>
org.apache.struts2.interceptor.validation.AnnotationValidationIntercepto
> r.doIntercept(AnnotationValidationInterceptor.java:49)
>          at 
>
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Me
> thodFilterInterceptor.java:86)
> 
> 
> 
> /SampleAction-validation.xml
> 
> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 
> 1.0.2//EN"
> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
> <validators>
>     <field name="formBean.lastName">
>        <field-validator type="requiredstring">
>           <message>You must enter a Last Name</message>
>        </field-validator>
>     </field>
>     <field name="formBean.maxValue">
>        <field-validator type="int">
>           <param name="min">13</param>
>           <param name="max">19</param>
>           <message>The max value must be between 13 and 19</message>
>        </field-validator>
>     </field>
> </validators>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> Notice:  This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
> New Jersey, USA 08889), and/or its affiliates (which may be known
> outside the United States as Merck Frosst, Merck Sharp & Dohme or
> MSD and in Japan, as Banyu - direct contact information for affiliates
is
> available at http://www.merck.com/contact/contacts.html) that may be
> confidential, proprietary copyrighted and/or legally privileged. It is
> intended solely for the use of the individual or entity named on this
> message. If you are not the intended recipient, and have received this
> message in error, please notify us immediately by reply e-mail and
> then delete it from your system.
> 
> 

Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or
MSD and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and
then delete it from your system.


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


Re: [s2] Problem getting basic server side field validation to work

Posted by 928572663 <92...@cox.net>.
Thanks David for the quick reply.

Is the 'input' result type used by the validation framework?  My action 
class does not return that.

Thanks,
John


Kawczynski, David wrote:
> You need to define a <result> of type input for your action. 
> 
> -----Original Message-----
> From: 928572663 [mailto:928572663@cox.net] 
> Sent: Tuesday, October 21, 2008 11:02 AM
> To: Struts Users Mailing List
> Subject: [s2] Problem getting basic server side field validation to work
> 
> I'm trying to do a very basic test app that demonstrates the server side
> 
> field validation and am getting an exception during initial JSP page 
> rendering.  The page and action work fine without the validation.
> 
> Any ideas what I may be missing?
> 
> I've read the confluence pages on validation, and have been keeping up 
> with the many posts on the mailing list, but they all seem to be various
> 
> advanced scenarios.
> 
> Here is some info to help:
> 
> * Using struts 2.1.2 basic (no plugins to speak of)
> * Using Zero Configuration (annotations) with no struts.xml
> * form bean is stored in session
> * action function works great w/o validation
> * when adding the SampleAction-validation.xml the exception happens 
> during initial page rendering
> 
> Here is the stack and last few logs:
> 
> 
> DEBUG [] [2008/10/21 09:01:12] 
> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] 
> Invoking validate() on action sample.SampleAction@17cad35
> DEBUG [] [2008/10/21 09:01:12] 
> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil] cannot 
> find method [validateDisplayForm] in action
> [sample.SampleAction@17cad35]
> DEBUG [] [2008/10/21 09:01:12] 
> [com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil] cannot 
> find method [validateDoDisplayForm] in action
> [sample.SampleAction@17cad35]
> DEBUG [] [2008/10/21 09:01:12] 
> [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] Errors 
> on action sample.SampleAction@17cad35, returning result name 'input'
> ERROR [] [2008/10/21 09:01:12] 
> [org.apache.struts2.dispatcher.Dispatcher] Could not find action or 
> result No result defined for action sample.SampleAction and result input
>          at 
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
> ionInvocation.java:357)
>          at 
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
> cation.java:259)
>          at 
> com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Vali
> dationInterceptor.java:248)
>          at 
> org.apache.struts2.interceptor.validation.AnnotationValidationIntercepto
> r.doIntercept(AnnotationValidationInterceptor.java:49)
>          at 
> com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Me
> thodFilterInterceptor.java:86)
> 
> 
> 
> /SampleAction-validation.xml
> 
> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 
> 1.0.2//EN"
> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
> <validators>
>     <field name="formBean.lastName">
>        <field-validator type="requiredstring">
>           <message>You must enter a Last Name</message>
>        </field-validator>
>     </field>
>     <field name="formBean.maxValue">
>        <field-validator type="int">
>           <param name="min">13</param>
>           <param name="max">19</param>
>           <message>The max value must be between 13 and 19</message>
>        </field-validator>
>     </field>
> </validators>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> Notice:  This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
> New Jersey, USA 08889), and/or its affiliates (which may be known
> outside the United States as Merck Frosst, Merck Sharp & Dohme or
> MSD and in Japan, as Banyu - direct contact information for affiliates is
> available at http://www.merck.com/contact/contacts.html) that may be
> confidential, proprietary copyrighted and/or legally privileged. It is
> intended solely for the use of the individual or entity named on this
> message. If you are not the intended recipient, and have received this
> message in error, please notify us immediately by reply e-mail and
> then delete it from your system.
> 
> 


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


RE: [s2] Problem getting basic server side field validation to work

Posted by "Kawczynski, David" <da...@merck.com>.
You need to define a <result> of type input for your action. 

-----Original Message-----
From: 928572663 [mailto:928572663@cox.net] 
Sent: Tuesday, October 21, 2008 11:02 AM
To: Struts Users Mailing List
Subject: [s2] Problem getting basic server side field validation to work

I'm trying to do a very basic test app that demonstrates the server side

field validation and am getting an exception during initial JSP page 
rendering.  The page and action work fine without the validation.

Any ideas what I may be missing?

I've read the confluence pages on validation, and have been keeping up 
with the many posts on the mailing list, but they all seem to be various

advanced scenarios.

Here is some info to help:

* Using struts 2.1.2 basic (no plugins to speak of)
* Using Zero Configuration (annotations) with no struts.xml
* form bean is stored in session
* action function works great w/o validation
* when adding the SampleAction-validation.xml the exception happens 
during initial page rendering

Here is the stack and last few logs:


DEBUG [] [2008/10/21 09:01:12] 
[com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] 
Invoking validate() on action sample.SampleAction@17cad35
DEBUG [] [2008/10/21 09:01:12] 
[com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil] cannot 
find method [validateDisplayForm] in action
[sample.SampleAction@17cad35]
DEBUG [] [2008/10/21 09:01:12] 
[com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil] cannot 
find method [validateDoDisplayForm] in action
[sample.SampleAction@17cad35]
DEBUG [] [2008/10/21 09:01:12] 
[com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] Errors 
on action sample.SampleAction@17cad35, returning result name 'input'
ERROR [] [2008/10/21 09:01:12] 
[org.apache.struts2.dispatcher.Dispatcher] Could not find action or 
result No result defined for action sample.SampleAction and result input
         at 
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct
ionInvocation.java:357)
         at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo
cation.java:259)
         at 
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Vali
dationInterceptor.java:248)
         at 
org.apache.struts2.interceptor.validation.AnnotationValidationIntercepto
r.doIntercept(AnnotationValidationInterceptor.java:49)
         at 
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Me
thodFilterInterceptor.java:86)



/SampleAction-validation.xml

<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 
1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
    <field name="formBean.lastName">
       <field-validator type="requiredstring">
          <message>You must enter a Last Name</message>
       </field-validator>
    </field>
    <field name="formBean.maxValue">
       <field-validator type="int">
          <param name="min">13</param>
          <param name="max">19</param>
          <message>The max value must be between 13 and 19</message>
       </field-validator>
    </field>
</validators>


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

Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or
MSD and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and
then delete it from your system.


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