配置文件如下:
<action-mappings>
<action path="/link"
type="com.myreply.service.link.LinkDetectServlet" parameter="m"
scope="request">
</action>
</action-mappings>
但运行后点击链接,出现如下错误:
ERROR DispatchAction:195 - Request[/link] does not contain handler parameter named 'm'. This may be caused by whitespace in the label text.高手看看如何解决?
<action-mappings>
<action path="/link"
type="com.myreply.service.link.LinkDetectServlet" parameter="m"
scope="request">
</action>
</action-mappings>
但运行后点击链接,出现如下错误:
ERROR DispatchAction:195 - Request[/link] does not contain handler parameter named 'm'. This may be caused by whitespace in the label text.高手看看如何解决?
try {
String user = req.getParameter("username");
String pwd = req.getParameter("password");
if(user.equals("admin")&& pwd.equals("123")){
HttpSession hs = req.getSession();
hs.setAttribute("password", pwd);//将密码写入session
hs.setMaxInactiveInterval(30);//设置session的默认时间,按秒来计算
res.sendRedirect("welcome?username=" + user+"&password="+ pwd);
}else{
res.sendRedirect("login");
}
} catch (Exception e) {
e.printStackTrace();
}
}
不要用excute方法,要自己重写个方法
然后m=方法名 就ok了