Servlet.service() for servlet action threw exception出错!!!! 急喔
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DynaValidatorForm loginForm = (DynaValidatorForm) form;// TODO Auto-generated method stub
String username=loginForm.getString( "userName ");
String password=loginForm.getString( "password ");
if(request.getAttribute( "rand ").equals(loginForm.getString( "rand "))&&userServiceImp.isUser(username, password))
{ HttpSession session=request.getSession();
Users us=userServiceImp.getUsersDAO().findByUName(username);
ApplicationContext context = new FileSystemXmlApplicationContext( "C://workspace//bookstore//WebRoot//WEB-INF//applicationContext.xml ");
RandomValus randomValus=new RandomValus();
MD5 md5=new MD5();
String code=md5.getMD5Instance().compute(randomValus.getRandomStr()).toUpperCase();
session.setAttribute( "name ",username);
session.setAttribute( "code ", code);
MapperIF mapper =(MapperIF)context.getBean( "net.sf.dozer.util.mapping.MapperIF ");
Users_static users_static= (Users_static) mapper.map(us,Users_static.class);
Vector userslist=new Vector();
userslist.add(users_static);
session.setAttribute( "users ", userslist);
return mapping.findForward( "success ");}
else return mapping.findForward( "faild ");
}
}
我的login.jsp
<h5> 登录 </h5>
<form id= "form1 " method= "post " action= "login.do ">
<label> 用户名
<input name= "userName " type= "text "/>
<a href= "register_step_one.do " target= "_blank " class= "font00F "> 注册新用户 </a> </label>
<label> 密 码
<input name= "password " type= "password "/>
</label>
<label> 验证码
<input name= "rand " size= "5 " type= "text "/>
<img id= "rand_img " src= "VerifyCode.jsp " width= "75 " hei