HTTP Status 404 - Invalid path was requested

15,339
 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)

Share:
15,339
Java Questions
Author by

Java Questions

Updated on June 04, 2022

Comments

  • Java Questions
    Java Questions almost 2 years

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

  • Java Questions
    Java Questions over 11 years
    Thanks for the info but it did not help as this will not be an issue
  • zb226
    zb226 about 7 years
    @JavaQuestions: Considering above comment, may I ask why you accepted the answer?
  • Zibbobz
    Zibbobz almost 4 years
    Downvoting this as it seems to only help a completely unrelated issue.