简体   繁体   English

有没有人有任何拦截器(i18n)在回发期间不会造成任何价值的经历?

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

Assume I have this struts2 form 假设我有这个struts2表单

<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 并且还有这个struts.xml设置

<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; 如果我在设置中添加了<interceptor-ref name="i18n"/> ,则表单提交后login_name将没有值; otherwise I can retrieve the value successfully. 否则我可以成功检索该值。 If you want me to provide further detail, please just let me know. 如果您希望我提供更多详细信息,请告诉我们。 Thanks in advance! 提前致谢!

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. 默认堆栈已经包含了i18n拦截器,所以没有必要自己添加它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM