HTTP状态404 - 请求了无效路径

时间:2012-10-18 07:37:59

标签: java struts

我正在使用struts1.2.9开发一个应用程序,以下是我的文件夹结构。 enter image description here

一旦我登录系统就可以了,我没有问题,以下是主页。 enter image description here

当我点击左侧的菜单时,我得到以下异常,页面看起来像这样

HTTP Status 404 - Invalid path was requested

enter image description here

我的菜单链接如下:<a href=\"#\" target=\"workFrame\" onclick=\"getMenuRequest('DepartmentAction','goToHome')\">"Department"</a>

这是javascript:

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

以下是我的动作类方法:

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

以下是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>

我正在使用framsets。

现在,当我点击菜单名称时,它会给出上述异常。

请帮忙。

此致

1 个答案:

答案 0 :(得分:2)

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

应改为

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

我假设* .do是web.xml中ActionServlet的url映射 用您的扩展名替换* .do(检查您的web.xml)