![](/img/trans.png)
[英]Change action attribute of Form for different action methods in Struts2
[英]Error in Form Action attribute struts2
我的login.jsp在web文件夾中。
並且為此指定的操作為:
<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>
<s:form action="secure/authenticateUser" method="post">
</s:form>
========================
第一次請求時,它就可以工作。
但是,如果validate()
方法的操作返回錯誤,則它將創建url為:
“表單”操作屬性的“安全/安全/ authenticateUser”。
我也嘗試過<s:url>
標記,但是仍然有同樣的問題有人可以幫助我。 或為此提供替代解決方案。
您在form標簽上的action屬性名稱可能錯誤。 采用
<s:form namespace="/secure" action="authenticateUser" method="post">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.