开发者

get invalid.token result at the first time run action

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>

        <intercep开发者_运维百科tor-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.


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


The problem is that your token is due.

If you choose to ignore the method, then you don't need to add the token tag

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜