You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thai Dang Vu <TV...@dhmh.state.md.us> on 2005/07/07 21:45:28 UTC

Which request is used in automatic Validation when the requirements aren't met?

Perhaps I stated it unclearly.

I am using automatic validation, not manual validation (which uses validate method of the form bean). If the requirements aren't met, Struts will lead us to the input page (in my case the /WEB-INF/provider/addprovider.jsp) without going to the execute method of the AddProviderAction class.

So my question is: is there any place I can interrupt the request before the addprovider.jsp appears and displays the errors (I use <html:errors/> in that page)?

>>> jbbeal@gmail.com 7/7/2005 3:01:34 PM >>>
If your input attribute identifies an Action instead of a JSP page,
you can do whatever you need to do within that Action.

On 7/7/05, Thai Dang Vu <TV...@dhmh.state.md.us> wrote:
> Hello everybody,
> 
> This is my action declaration in struts-config.xml
> 
>     <action path="/add_provider"
>             type="AddProviderAction"
>             name="addProviderForm"
>             input="/WEB-INF/provider/addprovider.jsp"
>             validate="true"
>             scope="request">
>     </action>
> 
> In addprovider.jsp page, when I click 'Submit' and the requirements aren't met, the request is forwarded to the input (which is /WEB-INF/provider/addprovider.jsp). How and where can I get the request before the input page appears (so that I can put something in the request to make the input displays correctly)?
> 
> Thanks.
> 
> 
>

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




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


Re: Which request is used in automatic Validation when the requirements aren't met?

Posted by Laurie Harper <la...@holoweb.net>.
Thai Dang Vu wrote:
> Perhaps I stated it unclearly.
> 
> I am using automatic validation, not manual validation (which uses validate method of the form bean). If the requirements aren't met, Struts will lead us to the input page (in my case the /WEB-INF/provider/addprovider.jsp) without going to the execute method of the AddProviderAction class.
> 
> So my question is: is there any place I can interrupt the request before the addprovider.jsp appears and displays the errors (I use <html:errors/> in that page)?

You weren't unclear, but Jeff's response was correct. He pointed out that 
your input can be an action, which can then do whatever you need, instead 
of a JSP. You just need to change your action mapping so the 'input' 
attribute names the mapping for your AddProviderAction rather than pointing 
at a JSP directly.

L.
-- 
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/~laurie/


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


Re: Which request is used in automatic Validation when therequirements aren't met?

Posted by Martin Gainty <mg...@hotmail.com>.
Good Afternoon Thai
Here is an example of building ActionErrors object inside execute() method 
of your Action class
http://publib.boulder.ibm.com/infocenter/wsad512/index.jsp?topic=/com.ibm.etools.struts.doc/topics/rstrdoc009.html
NOTE: If a message is required, this saves the specified key(s) into the 
request for use to be reported out  by <struts:errors> tag.
HTH,
Martin-

----- Original Message ----- 
From: "Thai Dang Vu" <TV...@dhmh.state.md.us>
To: <us...@struts.apache.org>
Sent: Thursday, July 07, 2005 3:45 PM
Subject: Which request is used in automatic Validation when therequirements 
aren't met?


Perhaps I stated it unclearly.

I am using automatic validation, not manual validation (which uses validate 
method of the form bean). If the requirements aren't met, Struts will lead 
us to the input page (in my case the /WEB-INF/provider/addprovider.jsp) 
without going to the execute method of the AddProviderAction class.

So my question is: is there any place I can interrupt the request before the 
addprovider.jsp appears and displays the errors (I use <html:errors/> in 
that page)?

>>> jbbeal@gmail.com 7/7/2005 3:01:34 PM >>>
If your input attribute identifies an Action instead of a JSP page,
you can do whatever you need to do within that Action.

On 7/7/05, Thai Dang Vu <TV...@dhmh.state.md.us> wrote:
> Hello everybody,
>
> This is my action declaration in struts-config.xml
>
>     <action path="/add_provider"
>             type="AddProviderAction"
>             name="addProviderForm"
>             input="/WEB-INF/provider/addprovider.jsp"
>             validate="true"
>             scope="request">
>     </action>
>
> In addprovider.jsp page, when I click 'Submit' and the requirements aren't 
> met, the request is forwarded to the input (which is 
> /WEB-INF/provider/addprovider.jsp). How and where can I get the request 
> before the input page appears (so that I can put something in the request 
> to make the input displays correctly)?
>
> Thanks.
>
>
>

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




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


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