Does anyone have any experience that interceptor(i18n) will cause no value during postback?

做~自己de王妃 提交于 2019-12-12 01:34:52

问题


Assume I have this struts2 form

<s:form action="login" method="post">
    <s:textfield key="login_name" name="login_name"/>
    <s:submit></s:submit>
</s:form>

And also with this struts.xml setting

<constant name="struts.custom.i18n.resources" value="messageResource" />
<constant name="struts.devMode" value="true" />
<package name="login" namespace="/" extends="struts-default">
    <action name="login" class="actions.index.index">
        <interceptor-ref name="i18n"/>
        <result name="LOGIN_SUCCESS">/Main.jsp</result>
        <result name="LOGIN">/Login.jsp</result>
    </action>
</package>

If I have added <interceptor-ref name="i18n"/> to the setting, login_name will have no value after form submitted; otherwise I can retrieve the value successfully. If you want me to provide further detail, please just let me know. Thanks in advance!


回答1:


You are adding only one interceptor for your action by doing so all other interceptors are not included. The default stack already includes i18n interceptor so no point to add it by yourself.



来源:https://stackoverflow.com/questions/14122984/does-anyone-have-any-experience-that-interceptori18n-will-cause-no-value-durin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!