HTTP 状态 500 - 无法在 struts 中创建路径 /adduser 的操作实例

vik*_*iii 5 java struts

我有一个 JSP 页面,其中有一个用于添加用户的超链接。

<html:link action="openadduser.do"> Add New User < /html:link>
Run Code Online (Sandbox Code Playgroud)

我的 struts-config 文件包含

<action-mappings>
        <action path="/login" name="LoginForm" validate="true" input="/index.jsp"
            type="useraction.LoginAction">
            <forward name="successadmin" path="/home.jsp" />
            <forward name="failure" path="/index.jsp" />
            <forward name="successuser" path="/welcome.jsp" />
        </action>

    <action path="/adduser" name="AdduserForm" validate="true" input="/adduser.jsp"
            type="useraction.AdduserActions">
            <forward name="success" path="/userconfirm.jsp" />
        </action>

       <action path="/openadduser" name="AdduserForm" validate="true" type="useraction.AdduserAction"
            input="/adduser.jsp">
            <forward name="success" path="/userconfirm.jsp" />
        </action>
</action-mappings>
Run Code Online (Sandbox Code Playgroud)

我的adduser.jsp包含代码

<html:form action="/adduser">
     < h1 align="center">  ADD NEW USER < /h1>
     < bean:message key="label.fname"/> <br/>
     <html:text property="fname"></html:text><br/>
     <html:errors property="fname" /><br/>
     </html:select>
    <html:submit/>
</html:form></body></html>
Run Code Online (Sandbox Code Playgroud)

AdduserAction.java 包含

public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception 
    {
        AdduserForm adduserForm = (AdduserForm) form;

        fname = adduserForm.getFname().toString();
        System.out.println(fname);
        return mapping.findForward("success");

    }
Run Code Online (Sandbox Code Playgroud)

我正在使用 Tomcat 服务器。单击提交按钮添加用户后,出现以下错误。 HTTP 状态 500 - 无法在 struts 中创建路径 /adduser 的操作实例。

我认为struts-config文件有问题。我能做些什么来消除这个错误?感谢您的帮助。

Zoh*_*aib 3

我认为在你的jsp中附加.do应该可以解决问题

<html:form action="adduser.do">
Run Code Online (Sandbox Code Playgroud)