Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP Status 500 - No action instance for path /adduser could be created in struts

Tags:

java

struts

I have a JSP page in which there is a hyperlink to add a user.

<html:link action="openadduser.do"> Add New User < /html:link>

My struts-config file contains

<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>

And my adduser.jsp contains code

<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>

AdduserAction.java contains

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");

    }

I am using a Tomcat server. After I click on the submit button to add a user, it gives the following error. HTTP Status 500 - No action instance for path /adduser could be created in struts.

I think there is a problem in the struts-config file. What can I do to remove this error? Thank you for the help.

like image 890
vikiiii Avatar asked Dec 20 '11 04:12

vikiiii


2 Answers

I think appending .do in your jsp should solve the problem

<html:form action="adduser.do">
like image 137
Zohaib Avatar answered Nov 09 '22 18:11

Zohaib


You cannot extend the 'Action' class in your LoginAction. That's the only reason for no action instance for path. You must extend the Action class, don't forget...

like image 38
anthonilawrance Avatar answered Nov 09 '22 19:11

anthonilawrance