问题描述
login.jsp:<formmethod="post"action="user/login"><tablealign="top"><tr><tdcolspan=""align="left">用户登录用户姓名:<inputtype="text"name="name"/>密码:<inputtype="password"name="password"/><inputtype="submit"value="登录"name="login"/><inputtype="button"value="取消"name="close"/></td></tr></table></form>-------------------------UserAction:publicclassUserActionextendsActionSupport{privateUserDaoud=newUserDao();privateUseruser;publicStringlogin(){/////参数可以没有//System.out.println(user.getName()+"-----------");if(ud.login(user)){///System.out.println("SUCCESS"+"--");return"success";//////""大写可以不要}else{System.out.println("LOGIN=====");return"error";}}publicUsergetUser(){returnuser;}publicvoidsetUser(Useruser){this.user=user;}}--------modle:publicclassUser{intid;Stringname;Stringpassword;Stringaddress;publicintgetId(){returnid;}publicvoidsetId(intid){this.id=id;}publicStringgetAddress(){returnaddress;}publicvoidsetAddress(Stringaddress){this.address=address;}publicStringgetName(){returnname;}publicvoidsetName(Stringname){this.name=name;}publicStringgetPassword(){returnpassword;}publicvoidsetPassword(Stringpassword){this.password=password;}publicUser(){}}
解决方案
解决方案二:
用户名<inputtype="text"name="user.name"/>密码:<inputtype="password"name="user.password"/>
解决方案三:
<inputtype="text"name="name"/>密码:<inputtype="password"name="password"/>改成<inputtype="text"name="user.name"/>密码:<inputtype="password"name="user.password"/>
解决方案四:
该回复于2011-03-22 09:33:19被版主删除
解决方案五:
<inputtype="password"name="user.password"/>
解决方案六:
二楼正解但是publicclassUserActionextendsActionSupport{privateUserDaoud=newUserDao();????直接操作数据
解决方案七:
+1引用1楼clarck_913的回复:
HTMLcode用户名<inputtype="text"name="user.name"/>密码:<inputtype="password"name="user.password"/>