Search code examples
struts

cannot retrieve mapping for action error


im using struts 1.2 and trying to create a link in jsp page with code

<html:link href="AdminModule/UserCreation.jsp" >
Create User </html:link> `

so that the link will move to page UserCreation in which the code like this is present

<html:form action="/adminUserCreation">
        AdminName : <html:text property="username"/><html:errors property="username"/><br/>
        Password : <html:password property="password"/><html:errors property="password"/><br/>
        <html:submit/>
    </html:form>

the struts-config file contain code like this

<form-beans>
<form-bean name="adminUserCreationForm" type="Admin.Form.AdminUserCreationForm" />
</form-beans>
<action-mappings>
<action
  attribute="adminUserCreationForm"
  input="/AdminModule/AdminHomePage.jsp"
  name="adminUserCreationForm"
  path="/adminUserCreation"
  scope="request"
  type="Admin.Action.AdminUserCreationAction"
  validate="false">
  <set-property property="cancellable" value="true" />
  <forward name="failure" path="/AdminModule/AdminErrorPage.jsp" />
  <forward name="success" path="/AdminSuccessPage.jsp" />
</action>
</action-mappings>

im getng exception

 An exception occurred processing JSP page /AdminModule/UserCreation.jsp at line 30


30:         <html:form action="/adminUserCreation">
31:             AdminName : <html:text property="username"/><html:errors   property="username"/><br/>
32:             Password : <html:password property="password"/><html:errors property="password"/><br/>
33:             <html:submit/>

root cause is

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve mapping for action /adminUserCreation

Solution

  • How to open one jsp from another through struts

    This helped me to solve it.. Maybe it will be helpful for anyone else who has the same problem.