tags:

views:

126

answers:

1

I use struts 2.1.8, I use <s:token> between <s:form> and </s:form>

in my struts.xml like that

............
<package name="user" namespace="/user" extends="struts-default">

<action name="login"class="user.UserAction">
 <result type="tiles">login.view</result>

        <interceptor-ref name="token"/>
        <interceptor-ref name="basicStack"/>  
        <result name="invalid.token">/pages/error.jsp</result>
</action>
</package> 
...............

at the first time, I run login.do action, I alway get error page. Plz give to me some suggestions thank in advance.

A: 

Hi,

You need to add parameter to exclude method on which you dont want to apply interceptor

for example at the very first run I used populate method to populate my page

<interceptor-ref name="token">
<param name="excludeMethods">populate</param>
</interceptor-ref>

if you have more than one method than you can use comma to separate methods

<interceptor-ref name="token">
<param name="excludeMethods">populate,add,save,anyothermethod</param>
</interceptor-ref>

Best Luck !

Regards, Asit Jaiswal

Asit Jaiswal