validation - execute action is not considering actual result name in Struts2 -


let me ask question, maybe simple, newbie in struts2.

i have action method in profileaction action:

@override public string execute() throws exception {     httpservletrequest request = servletactioncontext.getrequest();     httpsession session = request.getsession();     string id = (string) session.getattribute("id");     if (id != null && !id.equals("") && !id.equals("0")) {         return success;     }      return "nosession"; } 

and in xml:

    <action name="perfil" class="agenda.profileaction">         <result name="success" type="tiles">/profile.tiles</result>         <result name="nosession" type="tiles">/login.tiles</result>     </action>              <action name="conexion" class="agenda.profileaction" method="login">         <interceptor-ref name="jsonvalidationworkflowstack">             <param name="validation.excludemethods">init,input</param>         </interceptor-ref>         <result name="loginsuccess" type="tiles">/login/success.tiles</result>         <result name="loginerror" type="tiles">/login/error.tiles</result>     </action>                 

as see, have "nosession" result in default method, when run page, throws exception because "input" result required. when replace "nosession" in xml "input", works, side effect json validation not work.

it seems execute method not being called. have place throw exception , in fact, not called.

i traying call action way:

http://www.domain.com:8080/agendaplus/perfil

you're getting validation or type conversion error.

when happens, s2 attempt route "input" result re-fill form.

unrelated, getting values out of request negates lot of power of s2. consider working through tutorials/etc. , use built-in conveniences.


one easy, human-readable way @ interceptor stack use profiling interceptor. can configured default, or set on per-action basis:

<action name="themes" class="test.themesaction">   <interceptor-ref name="profiling">     <param name="profilingkey">profilingkey</param>   </interceptor-ref>   <interceptor-ref name="defaultstack"/>   <result>/web-inf/jsps/themes.jsp</result> </action> 

make request including "profilingkey" parameter set "true" , logs show:

2013-04-09 21:22:25,813 info  : [1959ms] - invoke:    [1959ms] - interceptor: exception     [1959ms] - invoke:        [1959ms] - interceptor: alias         [1959ms] - invoke:            [1959ms] - interceptor: servletconfig             [1957ms] - invoke:                [1957ms] - interceptor: i18n                 [1957ms] - invoke:                    [1957ms] - interceptor: prepare                     [1956ms] - invoke:                        [1956ms] - interceptor: chain                         [1956ms] - invoke:                            [1956ms] - interceptor: debugging                             [1956ms] - invoke:                                [1956ms] - interceptor: scopedmodeldriven                                 [1956ms] - invoke:                                    [1956ms] - interceptor: modeldriven                                     [1956ms] - invoke:                                        [1956ms] - interceptor: fileupload                                         [1956ms] - invoke:                                            [1956ms] - interceptor: checkbox                                             [1956ms] - invoke:                                                [1956ms] - interceptor: multiselect                                                 [1956ms] - invoke:                                                    [1956ms] - interceptor: staticparams                                                     [1955ms] - invoke:                                                        [1955ms] - interceptor: actionmappingparams                                                         [1955ms] - invoke:                                                            [1955ms] - interceptor: params                                                             [1954ms] - invoke:                                                                [1954ms] - interceptor: conversionerror                                                                 [1954ms] - invoke:                                                                    [1954ms] - interceptor: validation                                                                     [1897ms] - invoke:                                                                        [1897ms] - interceptor: workflow                                                                         [1897ms] - invoke:                                                                            [7ms] - invokeaction: themes                                                                           [1889ms] - executeresult: success 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -