gpt4 book ai didi

java - Request[/UsrAction] 不包含名为 'method' 的处理程序参数。这可能是由标签文本中的空格引起的

转载 作者:行者123 更新时间:2023-12-01 18:47:05 25 4
gpt4 key购买 nike

下面的代码在 Mozila Firefox、Internet Explorer 中工作正常,但在 google chrome 中出现上述错误。

adminlogin.jsp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Admin Role Page</title>
<script type="text/javascript">
function submitForm()
{
document.forms[0].action = "UsrAction.do?";
document.forms[0].submit();
}
</script>
</head>
<body>
<html:form action="/UsrAction" >
<html:submit property="method" value="lodable" onclick="submitForm() " />
<html:submit property="method" value="adduser" onclick="submitForm()" />
<html:submit property="method" value="addprogram" onclick="submitForm()"/>
</html:form>
</body>
</html>

struts-config.xml

<action input="/adminLogin.jsp" parameter="method" name="UsrForm" path="/UsrAction" scope="session" type="com.me.action.UsrAction">
<forward name="lodable" path="/pages/Lodable.jsp" />
<forward name="adduser" path="/pages/add.jsp" />
<forward name="addprog" path="/pages/program.jsp" />
</action>

UerAction.java

public class UsrAction extends DispatchAction {
private final static String lodable = "lodable";
private final static String adduser = "adduser";
private final static String addprog = "addprog";
public ActionForward lodable(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
UsrForm userForm = (UsrForm) form;
lgnDTO login = new lgnDTO();
request.setAttribute("login", login.getUsername());
return mapping.findForward(lodable);
}

public ActionForward adduser(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
UsrForm userForm = (UsrForm) form;
lgnDTO login = new lgnDTO();
return mapping.findForward(addprog);
}

public ActionForward addprogram(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
UsrForm userForm = (UsrForm) form;
lgnDTO login = new lgnDTO();
return mapping.findForward(adduser);
}
}

错误日志

type Exception report

message Request[/UsrAction] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text.

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Request[/UsrAction] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text.
org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:197)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:245)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.39 logs.

最佳答案

我认为由于您没有在 URL 中提及参数“method”,因此您收到了错误。我不确定 IE 和 FF 是如何工作的,但是如果你构建类似的 URLUsrAction.do?method=lodable 我相信,它也应该在 Chrome 中工作。

关于java - Request[/UsrAction] 不包含名为 'method' 的处理程序参数。这可能是由标签文本中的空格引起的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17318013/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com