有没有人有过拦截器(i18n)在回发期间不会产生任何价值的经验? [英] Does anyone have any experience that interceptor(i18n) will cause no value during postback?

查看:79
本文介绍了有没有人有过拦截器(i18n)在回发期间不会产生任何价值的经验?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有这个struts2表格

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>

还有这个struts.xml设置

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>

如果我在设置中添加了<interceptor-ref name="i18n"/>,则在提交表单后,login_name将没有任何值;否则,我可以成功检索该值. 如果您希望我提供更多详细信息,请告诉我.预先感谢!

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!

推荐答案

通过添加操作,您仅添加了一个拦截器,因此不包括所有其他拦截器.默认堆栈已包含i18n拦截器,因此没有必要自己添加.

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)在回发期间不会产生任何价值的经验?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆