首页

SSH框架J2ee实例(实现了登陆操作)

java

2020-6-26

package com.sunline.action;

import java.util.List;
import java.util.Map;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sunline.biz.UserBiz;
import com.sunline.entity.User;

public class LoginAction extends ActionSupport {
	private static final long serialVersionUID = 1889710968497585080L;
	private String userName;
	private String userPassword;
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserPassword() {
		return userPassword;
	}
	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}
	@Override
	public String execute() throws Exception {
	    //加载applicationContext.xml配置  
	    ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml"); 
	    //获取配置中的实例  
	    UserBiz userBiz =(UserBiz)context.getBean("userBiz"); 
	    User user = new User();
	    user.setUserName(this.userName);
	    user.setUserPassword(this.userPassword);
	    List<User> list = userBiz.Login(user);
	    if(list.size()>=1){
			ActionContext text = ActionContext.getContext();
			Map<String, Object> session = text.getSession();
		//	session.put("user",list);
			session.put("user",this.userName);
			return SUCCESS;
	    }else{
	    	return ERROR;
	    }
	}
	
}

资源下载此资源下载价格为3D币(VIP免费),请先
资源文件列表
SSHTest/.classpath , 4845
SSHTest/.myhibernatedata , 600
SSHTest/.mymetadata , 294
SSHTest/.mystrutsdata , 240
SSHTest/.project , 2243
SSHTest/.settings/.jsdtscope , 500
SSHTest/.settings/org.eclipse.jdt.core.prefs , 395
SSHTest/.settings/org.eclipse.wst.common.component , 459
SSHTest/.settings/org.eclipse.wst.common.project.facet.core.xml , 252
SSHTest/.settings/org.eclipse.wst.jsdt.ui.superType.container , 49
SSHTest/.settings/org.eclipse.wst.jsdt.ui.superType.name , 6
SSHTest/.settings/org.springframework.ide.eclipse.core.prefs , 217
SSHTest/.springBeans , 462
SSHTest/hibernate.reveng.xml , 546
SSHTest/src/applicationContext.xml , 2225
SSHTest/src/com/sunline/action/LoginAction.java , 1563
SSHTest/src/com/sunline/biz/UserBiz.java , 1061
SSHTest/src/com/sunline/dao/UserDao.java , 3076
SSHTest/src/com/sunline/entity/User.hbm.xml , 1013
SSHTest/src/com/sunline/entity/User.java , 1120
SSHTest/src/com/sunline/test/Test.java , 2275
SSHTest/src/struts.xml , 470
SSHTest/WebRoot/bootstrap-3.3.7/css/bootstrap-theme.css , 26132
SSHTest/WebRoot/bootstrap-3.3.7/css/bootstrap-theme.css.map , 47706
SSHTest/WebRoot/bootstrap-3.3.7/css/bootstrap-theme.min.css , 23409
SSHTest/WebRoot/bootstrap-3.3.7/css/bootstrap-theme.min.css.map , 25648
SSHTest/WebRoot/bootstrap-3.3.7/css/bootstrap.css , 146010
SSHTest/WebRoot/bootstrap-3.3.7/css/bootstrap.css.map , 389287
SSHTest/WebRoot/bootstrap-3.3.7/css/bootstrap.min.css , 121200
SSHTest/WebRoot/bootstrap-3.3.7/css/bootstrap.min.css.map , 542194
SSHTest/WebRoot/bootstrap-3.3.7/css/fileinput.css , 10583
SSHTest/WebRoot/bootstrap-3.3.7/css/fileinput.min.css , 7937
SSHTest/WebRoot/bootstrap-3.3.7/css/style.css , 1292
SSHTest/WebRoot/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot , 20127
SSHTest/WebRoot/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg , 108738
SSHTest/WebRoot/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf , 45404
SSHTest/WebRoot/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff , 23424
SSHTest/WebRoot/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 , 18028
SSHTest/WebRoot/bootstrap-3.3.7/js/bootstrap.js , 69707
SSHTest/WebRoot/bootstrap-3.3.7/js/bootstrap.min.js , 37045
SSHTest/WebRoot/bootstrap-3.3.7/js/npm.js , 484
SSHTest/WebRoot/error.jsp , 967
SSHTest/WebRoot/image/1.jpg , 763262
SSHTest/WebRoot/image/3.jpg , 335669
SSHTest/WebRoot/image/405.jpg , 33279
SSHTest/WebRoot/index.jsp , 3064
SSHTest/WebRoot/js/bootstrap.js , 69707
SSHTest/WebRoot/js/bootstrap.min.js , 37045
SSHTest/WebRoot/js/jquery-1.7.2.min.js , 94844
SSHTest/WebRoot/js/jquery-3.0.0.js , 263268
SSHTest/WebRoot/js/npm.js , 484
SSHTest/WebRoot/META-INF/MANIFEST.MF , 36
SSHTest/WebRoot/success.jsp , 913
SSHTest/WebRoot/WEB-INF/classes/applicationContext.xml , 2225
SSHTest/WebRoot/WEB-INF/classes/com/sunline/action/LoginAction.class , 2291
SSHTest/WebRoot/WEB-INF/classes/com/sunline/biz/UserBiz.class , 1674
SSHTest/WebRoot/WEB-INF/classes/com/sunline/dao/UserDao$1.class , 1727
SSHTest/WebRoot/WEB-INF/classes/com/sunline/dao/UserDao.class , 3363
SSHTest/WebRoot/WEB-INF/classes/com/sunline/entity/User.class , 1416
SSHTest/WebRoot/WEB-INF/classes/com/sunline/entity/User.hbm.xml , 1013
SSHTest/WebRoot/WEB-INF/classes/com/sunline/test/Test.class , 1437
SSHTest/WebRoot/WEB-INF/classes/struts.xml , 470
SSHTest/WebRoot/WEB-INF/lib/antlr-2.7.6.jar , 443432
SSHTest/WebRoot/WEB-INF/lib/c3p0-0.9.1.jar , 608376
SSHTest/WebRoot/WEB-INF/lib/cglib-2.2.jar , 278682
SSHTest/WebRoot/WEB-INF/lib/com.springsource.com.mchange.v2.c3p0-0.9.1.2.jar , 617643
SSHTest/WebRoot/WEB-INF/lib/com.springsource.net.sf.cglib-2.2.0.jar , 326765
SSHTest/WebRoot/WEB-INF/lib/com.springsource.org.aopalliance-1.0.0.jar , 4615
SSHTest/WebRoot/WEB-INF/lib/com.springsource.org.apache.commons.lang-2.4.0.jar , 263867
SSHTest/WebRoot/WEB-INF/lib/com.springsource.org.apache.commons.logging-1.1.1.jar , 61464
SSHTest/WebRoot/WEB-INF/lib/com.springsource.org.apache.commons.pool-1.5.3.jar , 97124
SSHTest/WebRoot/WEB-INF/lib/com.springsource.org.apache.log4j-1.2.15.jar , 396713
SSHTest/WebRoot/WEB-INF/lib/com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar , 1642154
SSHTest/WebRoot/WEB-INF/lib/commons-collections-3.1.jar , 559366
SSHTest/WebRoot/WEB-INF/lib/commons-dbcp.jar , 121757
SSHTest/WebRoot/WEB-INF/lib/dom4j-1.6.1.jar , 313898
SSHTest/WebRoot/WEB-INF/lib/ehcache-1.2.3.jar , 208048
SSHTest/WebRoot/WEB-INF/lib/ejb3-persistence.jar , 50583
SSHTest/WebRoot/WEB-INF/lib/hibernate-annotations.jar , 279714
SSHTest/WebRoot/WEB-INF/lib/hibernate-commons-annotations.jar , 66993
SSHTest/WebRoot/WEB-INF/lib/hibernate-entitymanager.jar , 119292
SSHTest/WebRoot/WEB-INF/lib/hibernate-validator.jar , 62574
SSHTest/WebRoot/WEB-INF/lib/hibernate3.jar , 2421736
SSHTest/WebRoot/WEB-INF/lib/javassist-3.9.0.GA.jar , 597476
SSHTest/WebRoot/WEB-INF/lib/jboss-cache-1.4.1.GA.jar , 706964
SSHTest/WebRoot/WEB-INF/lib/jbosscache-core-3.1.0.GA.jar , 1152731
SSHTest/WebRoot/WEB-INF/lib/jotm.jar , 124316
SSHTest/WebRoot/WEB-INF/lib/jta-1.1.jar , 13236
SSHTest/WebRoot/WEB-INF/lib/log4j-1.2.14.jar , 367444
SSHTest/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.10-bin.jar , 724225
SSHTest/WebRoot/WEB-INF/lib/org.springframework.aop-3.0.5.RELEASE.jar , 321190
SSHTest/WebRoot/WEB-INF/lib/org.springframework.asm-3.0.5.RELEASE.jar , 53082
SSHTest/WebRoot/WEB-INF/lib/org.springframework.aspects-3.0.5.RELEASE.jar , 35548
SSHTest/WebRoot/WEB-INF/lib/org.springframework.beans-3.0.5.RELEASE.jar , 555410
SSHTest/WebRoot/WEB-INF/lib/org.springframework.context-3.0.5.RELEASE.jar , 668861
SSHTest/WebRoot/WEB-INF/lib/org.springframework.core-3.0.5.RELEASE.jar , 382442
SSHTest/WebRoot/WEB-INF/lib/org.springframework.expression-3.0.5.RELEASE.jar , 169752
SSHTest/WebRoot/WEB-INF/lib/org.springframework.instrument-3.0.5.RELEASE.jar , 1810
SSHTest/WebRoot/WEB-INF/lib/org.springframework.instrument.tomcat-3.0.5.RELEASE.jar , 5728
SSHTest/WebRoot/WEB-INF/lib/org.springframework.jdbc-3.0.5.RELEASE.jar , 385712
SSHTest/WebRoot/WEB-INF/lib/org.springframework.orm-3.0.5.RELEASE.jar , 334327
SSHTest/WebRoot/WEB-INF/lib/org.springframework.transaction-3.0.5.RELEASE.jar , 231922
SSHTest/WebRoot/WEB-INF/lib/oscache-2.1.jar , 114308
SSHTest/WebRoot/WEB-INF/lib/persistence.jar , 70934
SSHTest/WebRoot/WEB-INF/lib/proxool-0.8.3.jar , 475943
SSHTest/WebRoot/WEB-INF/lib/slf4j-api-1.5.8.jar , 23445
SSHTest/WebRoot/WEB-INF/lib/slf4j-log4j12-1.5.8.jar , 9679
SSHTest/WebRoot/WEB-INF/lib/swarmcache-1.0RC2.jar , 30602
SSHTest/WebRoot/WEB-INF/lib/xapool.jar , 91815
SSHTest/WebRoot/WEB-INF/web.xml , 705
没有账号? 忘记密码?

社交账号快速登录