You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jan Fredrik Øveraasen <ja...@cellnetwork.no> on 2001/07/25 23:40:48 UTC

calling actionmapping from a URL

Hi
I have a action class that is used in several actionmappings and in some
situations it is called directly
from a url, like "href=myaction.do", but in these cases the validation
implemented prevents me from continuing the process.
My question is: how can i turn off validation when calling a action class
from a URL.

thanks in advance

Jan Fredrik

	___ Jan Fredrik Øveraasen | Senior Systems Developer 
	___ Cell Network ASA | Pb. 5313, Sørkedalsv. 10A, N-0304 Oslo,
Norway
	___ Tel: +47 23196600/35 | Fax: +47 23196601 | Mob: +47 93 49 99 88
   ___ http://www.cellnetwork.com/ |
mailto:jan.fredrik.overaasen@cellnetwork.no

 

Re: calling actionmapping from a URL

Posted by Ted Husted <hu...@apache.org>.
The ActionMapping has a property for validation. To call the Action
without validation, set 

validate=false

in your ActionMapping. 

An Action is not a servlet, and you cannot call it directly from an URL.
In every case, the request is passed to the ActionServlet by the
container. The ActionServlet determines which Action to use by referring
to the ActionMappings. So in the example case, you must have mapping
named "myaction", or else it could not be called. You may wish to set
validate=false for that mapping, and leave it at true for the others.

If there is some other type of validation occuring in your Action, which
you put in yourself, you could check the mapping object passed to
perform() to see if validation should be used or not. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/


Jan Fredrik Øveraasen wrote:
> 
> Hi
> I have a action class that is used in several actionmappings and in some
> situations it is called directly
> from a url, like "href=myaction.do", but in these cases the validation
> implemented prevents me from continuing the process.
> My question is: how can i turn off validation when calling a action class
> from a URL.
> 
> thanks in advance
> 
> Jan Fredrik
> 
>         ___ Jan Fredrik Øveraasen | Senior Systems Developer
>         ___ Cell Network ASA | Pb. 5313, Sørkedalsv. 10A, N-0304 Oslo,
> Norway
>         ___ Tel: +47 23196600/35 | Fax: +47 23196601 | Mob: +47 93 49 99 88
>    ___ http://www.cellnetwork.com/ |
> mailto:jan.fredrik.overaasen@cellnetwork.no
> 
>

Re: calling actionmapping from a URL

Posted by Oleg V Alexeev <oa...@apache.org>.
Hello Jan,

Thursday, July 26, 2001, 1:40:48 AM, you wrote:

JFØ> Hi
JFØ> I have a action class that is used in several actionmappings and in some
JFØ> situations it is called directly
JFØ> from a url, like "href=myaction.do", but in these cases the validation
JFØ> implemented prevents me from continuing the process.
JFØ> My question is: how can i turn off validation when calling a action class
JFØ> from a URL.

Is is simple - set validate attribute in action mapping to false:

    <action    path="/registration/register"
               name="registrationForm"
               input="/WEB-INF/jsp/registration.jsp"
               validate="true"
               type="com.rb.action.RegisterAction">
        <forward        name="confirm"          path="/WEB-INF/jsp/confirmRegister.jsp"/>
    </action>



-- 
Best regards,
 Oleg                            mailto:oalexeev@apache.org