ssh login integration case

After the execution jumps to Action User exitUser = userService.login (user); (where incoming object user) to the service and then execute Sql statement this.getHibernateTemplate () find ( "from User where username = after Dao and password =.? ? ", user.getUsername (), user.getPassword ()) returns a list such as collection **

List list = this.getHibernateTemplate().find(" from User where username= ? and password= ? ",user.getUsername(),user.getPassword()); if(list.size()!=0) { return list.get(0); }

**
so basically complete the next to complete a small part.
If the return value in the list with the login method Action of
the User exitUser = userService.login (User);
System.out.println (exitUser);
IF (exitUser == null) {
System.out.println ( "Error Log");
this.addActionError ( "user name or password error");
return "loginInput";
} the else {
ServletActionContext.getRequest () the getSession () the setAttribute ( "exitUser", exitUser);..
return "loginSuccess";
}
then the page wrong message <s: actionerror />
If parity error is to use <s: fielderror fieldName = "name value">.
. ServletActionContext.getRequest () getSession () setAttribute ( "exitUser", exitUser);.
The value of the user stored in the page is determined
<S: = IF Test "# session.exitUser = null!">
<S: Property value = " # session.exitUser ">
</s:if>
<s:else>

Landed

registered

Guess you like

Origin blog.csdn.net/qq_41922566/article/details/94428472