在窗体操作错误struts2的属性(Error in Form Action attribute s

2019-08-19 19:43发布

我的login.jsp是在Web文件夹中。

而对于这个动作被指定为:

在struts.xml

<package name="admin" extends="struts-default" namespace="/secure">

<action class="actions.LoginAction" name="authenticateUser">
    <result name="success" type="redirect">index</result>
    <result name="input">/login.jsp</result>
    <result name="error">/login.jsp</result>
</action>
</package>

login.jsp的

<s:form action="secure/authenticateUser" method="post">

</s:form>

========================

在第一次请求它的工作原理。

但是,如果validate()动作的方法返回错误,那么它会创建网址为:

“安全/安全/的authenticateUser”为形式的行动属性。

我也试过<s:url>标签,但还是同样的问题,任何人可以帮助我。 或可提供用于此替代的解决方案。

Answer 1:

在表单标签的action属性可能有一个错误的名字。 使用

<s:form namespace="/secure" action="authenticateUser" method="post"> 


文章来源: Error in Form Action attribute struts2