我是 Struts 2 框架的新手,在单击提交按钮时从一个命名空间更改为另一个命名空间时遇到问题,我收到此错误。
struts.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="module-login" namespace="/login" extends="struts-default">
<action name="verifier" class="presentation.LoginAction" method="verifierLogin">
<result name="model.Client">/vuesJSP/client/client.jsp</result>
<result name="model.Administrateur">/vuesJSP/admin/ajouterClient.jsp</result>
<result name="error">/vuesJSP/login/login.jsp</result>
<result name="input">/vuesJSP/login/login.jsp</result>
</action>
</package>
<package name="module-Admin" namespace="/admin" extends="struts-default">
<action name="ajouter" class="presentation.AdminAction" method="ajouterClient">
<result name="success">/vuesJSP/admin/ajouterClient.jsp</result>
<result name="error">/vuesJSP/admin/ajouterClient.jsp</result>
<result name="input">/vuesJSP/admin/ajouterClient.jsp</result>
</action>
<action name="modifier" class="presentation.AdminAction" method="modifierClient">
</action>
<action name="supprimer" class="presentation.AdminAction" method="supprimerClient">
</action>
<action name="lister" class="presentation.AdminAction" method="listerClients">
</action>
</package>
表单.jsp
<s:form method="post">
<s:textfield name="nom" label="Nom"></s:textfield>
<s:textfield name="prenom" label="prenom"></s:textfield>
<s:textfield name="cin" label="cin"></s:textfield>
<s:textfield name="login" label="login"></s:textfield>
<s:textfield name="password" label="password"></s:textfield>
<s:submit value="Ajouter Client" action="admin/ajouter"></s:submit>
<s:submit value="Lister les clients" action="admin/lister"></s:submit>
</s:form>
单击“ajouter 客户端”按钮时的实际错误
Error HTTP 404 - There is no Action mapped for namespace /login and action name admin/ajouter.
我想在单击“ajouter 客户端”按钮时将 url 从“ http://localhost:8080/GestionCommandes/login/verifier.action ”更改为“ http://localhost:8080/GestionCommandes/admin/ajouter.action ”
有什么办法可以实现吗?