资源简介
SSH2框架搭建实例(spring3.2+strust2.3.4+hibernate4.2)全部采用最新版本.演示了用户登录和用户管理
代码片段和文件信息
package com.jialin.action;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import org.springframework.web.client.HttpServerErrorException;
import com.jialin.entity.User;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
@Override
public String execute() throws Exception {
HttpServletRequest request=ServletActionContext.getRequest();
System.out.println(request.getCharacterEncoding());
if(“root“.equals(user.getName()) && “root123“.equals(user.getPassword()))
{
Map session=ActionContext.getContext().getSession();
session.put(“user.name“ user.getName());
System.out.println(“登录成功用户名=“+user.getName());
return “success“;
}
System.out.println(“登录失败,用户名=“+user.getName());
return “fail“;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-04-23 10:20 ssh2_test\
文件 588 2013-04-22 20:30 ssh2_test\.classpath
文件 1250 2013-04-23 10:20 ssh2_test\.project
目录 0 2013-04-22 20:29 ssh2_test\.settings\
文件 503 2013-04-22 20:29 ssh2_test\.settings\.jsdtscope
文件 364 2013-04-22 20:29 ssh2_test\.settings\org.eclipse.jdt.core.prefs
文件 479 2013-04-22 20:30 ssh2_test\.settings\org.eclipse.wst.common.component
文件 305 2013-04-22 20:29 ssh2_test\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2013-04-22 20:29 ssh2_test\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2013-04-22 20:29 ssh2_test\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 444 2013-04-23 16:25 ssh2_test\.springBeans
目录 0 2013-04-22 20:29 ssh2_test\build\
目录 0 2013-04-24 21:12 ssh2_test\build\classes\
目录 0 2013-04-24 21:12 ssh2_test\build\classes\com\
目录 0 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\
目录 0 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\action\
文件 1964 2013-04-24 21:34 ssh2_test\build\classes\com\jialin\action\LoginAction.class
文件 1851 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\action\UserAction.class
目录 0 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\dao\
文件 202 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\dao\IUserDao.class
文件 1764 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\dao\UserDaoImp.class
目录 0 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\entity\
文件 1587 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\entity\User.class
目录 0 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\exception\
文件 954 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\exception\MyException.class
目录 0 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\filter\
文件 1403 2013-04-24 21:13 ssh2_test\build\classes\com\jialin\filter\CharsetEncodingFilter.class
目录 0 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\interceptor\
文件 1464 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\interceptor\CheckLogin.class
目录 0 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\service\
文件 212 2013-04-24 21:12 ssh2_test\build\classes\com\jialin\service\IUserManage.class
............此处省略86个文件信息
- 上一篇:模拟电子技术完整课件
- 下一篇:SSH1框架搭建
评论
共有 条评论