[英]Struts2 + WAS 6.1 + Java EE
This "struts.xml": 这个“ struts.xml”:
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<package name="register" namespace="/" extends="struts-default">
<action name="Register" class="com.struts2.RegisterAction">
<result name="input">/register.jsp</result>
<result type="redirectAction">register.jsp</result>
</action>
</package>
Works perfectly fine in Tomcat but always generates following error always in WAS 6.1: 在Tomcat中工作得很好,但始终在WAS 6.1中始终生成以下错误:
" There is no Action mapped for namespace / and action name . - [unknown location]" “没有为名称空间/和动作名称映射动作。-[未知位置]”
But if I modify the "struts.xml" like following then it works fine in WAS6.1: 但是,如果我像下面那样修改“ struts.xml”,则它在WAS6.1中可以正常工作:
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<package name="register" namespace="/register" extends="struts-default">
<action name="Register" class="com.struts2.RegisterAction">
<result name="input">/register.jsp</result>
<result type="redirectAction">register.jsp</result>
</action>
</package>
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index" />
<action name="index">
<result type="redirectAction">
<param name="actionName">Register</param>
<param name="namespace">/register</param>
</result>
</action>
</package>
I totally can't understand what is the reason. 我完全不明白是什么原因。 It's always looking for I believe the action name "index". 我一直在寻找动作名称“索引”。 Can anyone explain what the reason is? 谁能解释原因是什么?
I am not sure if this is the cause of the issue but I can't see where you have defined an action in your struts.xml called "register.jsp". 我不确定这是否是导致问题的原因,但是我看不到您在struts.xml中定义了一个名为“ register.jsp”的操作的位置。 The result type "redirectAction" is used to target a struts2 action. 结果类型“ redirectAction”用于定位struts2动作。 On input you do not specify a type so the default is assumed which is "dispatcher". 在输入时,您没有指定类型,因此假定默认值为“ dispatcher”。
Change: 更改:
<result type="redirectAction">register.jsp</result>
with 与
<result>register.jsp</result>
Which assumes the request type is "dispatcher" (a jsp) and the name is "success". 假设请求类型为“ dispatcher”(一个jsp),名称为“ success”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.