我跟着尚学堂的视频做项目 为什么他是对的 而我有错误啊?
public class LoginAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
LoginActionForm laf = (LoginActionForm)form;
String username = laf.getUsername();
String password = laf.getPassword();
if("admin".equals(username) && "admin".equals(password)) {
//转向登录成功
}else {
//转向登录失败
}
return super.execute(mapping, form, request, response);
}}
LoginActionForm laf = (LoginActionForm)form;说这一句不能转换为LoginActionForm
public class LoginAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
LoginActionForm laf = (LoginActionForm)form;
String username = laf.getUsername();
String password = laf.getPassword();
if("admin".equals(username) && "admin".equals(password)) {
//转向登录成功
}else {
//转向登录失败
}
return super.execute(mapping, form, request, response);
}}
LoginActionForm laf = (LoginActionForm)form;说这一句不能转换为LoginActionForm
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货