java HTTP 状态 404 - 请求的路径无效
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12949488/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTTP Status 404 - Invalid path was requested
提问by Java Questions
i am developing an application using struts1.2.9 and the following is my folder structure.
我正在使用 struts1.2.9 开发一个应用程序,以下是我的文件夹结构。
once i login to the system it is fine and i get no issue, following is the home page.
一旦我登录到系统就很好并且我没有问题,以下是主页。
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
my menu link is like this : <a href=\"#\" target=\"workFrame\" onclick=\"getMenuRequest('DepartmentAction','goToHome')\">"Department"</a>
我的菜单链接是这样的: <a href=\"#\" target=\"workFrame\" onclick=\"getMenuRequest('DepartmentAction','goToHome')\">"Department"</a>
and this the javascript :
这是 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
以下是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
问候
采纳答案by harrybvp
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)
我假设 *.do 是 web.xml 中 ActionServlet 的 url 映射,
将 *.do 替换为您的扩展名(检查您的 web.xml)