Search code examples
javastruts

HTTP Status 404 - Invalid path was requested


I am developing an application using struts1.2.9 and the following is my folder structure. enter image description here

Once I login to the system it is fine and I get no issue, following is the home page. enter image description here

and when I click on the menu which is there at the left side than I get the following exception and the page looks like this

HTTP Status 404 - Invalid path was requested

enter image description here

my menu link is like this : <a href=\"#\" target=\"workFrame\" onclick=\"getMenuRequest('DepartmentAction','goToHome')\">"Department"</a>

and this is the javascript:

function getMenuRequest(actionName,methodName){
                       document.forms[0].action=actionName+".htm";
                       document.forms[0].method.value=methodName;
                       document.forms[0].submit();
                   }

the following is my action class method:

public ActionForward goToHome(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        //call method to verify Pagetoken
        forwardRequestTo = "departmentHome";
        return mapping.findForward(forwardRequestTo);
    }

and the following is the struts-config.xml

<action path="/DepartmentAction" name="SecurEyesForm" type="com.secureyes.eswastha.struts.action.DepartmentAction" scope="request" parameter="method" validate="false">
            <forward name="departmentHome" path="/WEB-INF/Masters/DepartmentMaster.jsp"></forward>            
        </action>

I am using framsets.

Now when I click on the menu name it is giving the above exception.

Please help.

Regards


Solution

  •  document.forms[0].action=actionName+".htm";
    

    should be changed to

     document.forms[0].action=actionName+".do"; 
    

    i am assuming *.do to be the url mapping for ActionServlet in web.xml
    replace *.do with your extension (check your web.xml)