package com.adminSystem.web;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import com.adminSystem.entity.UserInfo;
import com.adminSystem.service.UserService;
import com.adminSystem.service.impl.UserServiceImpl;
import com.opensymphony.xwork2.ActionSupport;
@SuppressWarnings("serial")
public class LoginAction extends ActionSupport{
// @Autowired
private UserInfo userInfo;
@Resource
private UserService userService;
public UserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}
public String getLogin() throws Exception
{
System.out.println(userInfo.getPassword());
Boolean flag = this.userService.isLogin(userInfo);
if(flag)
{
return SUCCESS;
}else
{
return ERROR;
}
}
/**
validate()方法,是默认的验证。
我们可以在我们的action类中重写一下此方法。
比方说验证用户名是否为空。这个方法不需要调用,
当S:FORM表单提交了,到了action类中会首先执行此方法。
对数据进行验证。
***/
public void validate()
{
if(userInfo.getUsername() == null || userInfo.getPassword() ==null )
{
super.addActionError("用户名或密码不能为空");
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
数据库sqlserver 2008 spring-framework-3.1.3.RELEASE struts-2.3.7-all hibernate-distribution-3.6.0.Beta3-dis jdk 7.0 tomcat 7 数据库:Test 表名:userInfo CREATE TABLE [dbo].[userInfo]( [id] [int] IDENTITY(1,1) NOT NULL, [username] [varchar](20) NULL, [password] [varchar](20) NULL )
资源推荐
资源详情
资源评论
收起资源包目录
7RoadAdminSystem1201.rar (90个子文件)
7RoadAdminSystem
src
applicationContext-beans.xml 1KB
struts-user.xml 471B
com
adminSystem
entity
UserInfo.java 501B
UserInfo.hbm.xml 611B
dao
UserDAO.java 184B
impl
UserDAOImpl.java 825B
util
service
UserService.java 187B
impl
UserServiceImpl.java 602B
web
UserAction.java 901B
LoginAction.java 1KB
tagslib
struts.xml 904B
applicationContext-actions.xml 1KB
struts-login.xml 514B
hibernate.cfg.xml 2KB
applicationContext-comms.xml 2KB
.classpath 5KB
build
classes
applicationContext-beans.xml 1KB
struts-user.xml 471B
com
adminSystem
entity
UserInfo.hbm.xml 611B
UserInfo.class 944B
dao
UserDAO.class 247B
impl
UserDAOImpl.class 2KB
util
service
UserService.class 259B
impl
UserServiceImpl.class 875B
web
UserAction.class 1KB
LoginAction.class 2KB
tagslib
struts.xml 904B
applicationContext-actions.xml 1KB
struts-login.xml 514B
hibernate.cfg.xml 2KB
applicationContext-comms.xml 2KB
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 305B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.component 478B
.jsdtscope 503B
org.eclipse.jdt.core.prefs 395B
WebContent
META-INF
MANIFEST.MF 39B
index.jsp 779B
error.jsp 378B
welcome.jsp 643B
WEB-INF
lib
javassist-3.12.0.GA.jar 618KB
org.springframework.instrument-3.1.0.RELEASE.jar 7KB
org.springframework.web.struts-3.1.0.RELEASE.jar 31KB
ehcache-1.5.0.jar 258KB
commons-logging-1.1.1.jar 59KB
backport-util-concurrent.jar 320KB
aopalliance.jar 4KB
org.springframework.orm-3.1.0.RELEASE.jar 369KB
dom4j-1.6.1.jar 307KB
c3p0-0.9.1.jar 594KB
org.springframework.beans-3.1.0.RELEASE.jar 575KB
xwork-core-2.3.7.jar 622KB
struts2-spring-plugin-2.3.7.jar 21KB
org.springframework.web-3.1.0.RELEASE.jar 528KB
sqljdbc4.jar 413KB
aspectjweaver-1.5.3.jar 1.8MB
common-annotations.jar 6KB
org.springframework.aop-3.1.0.RELEASE.jar 324KB
hibernate3.jar 3.88MB
org.springframework.oxm-3.1.0.RELEASE.jar 69KB
slf4j-nop-1.7.2.jar 4KB
commons-fileupload-1.2.2.jar 58KB
org.springframework.jdbc-3.1.0.RELEASE.jar 392KB
antlr-2.7.6.jar 433KB
struts2-core-2.3.7.jar 775KB
org.springframework.aspects-3.1.0.RELEASE.jar 49KB
org.springframework.instrument.tomcat-3.1.0.RELEASE.jar 11KB
org.springframework.web.portlet-3.1.0.RELEASE.jar 186KB
commons-lang3-3.1.jar 308KB
org.springframework.expression-3.1.0.RELEASE.jar 172KB
org.springframework.test-3.1.0.RELEASE.jar 224KB
org.springframework.web.servlet-3.1.0.RELEASE.jar 559KB
hibernate-jpa-2.0-api-1.0.0.Final.jar 99KB
org.springframework.context.support-3.1.0.RELEASE.jar 104KB
org.springframework.jms-3.1.0.RELEASE.jar 194KB
freemarker-2.3.19.jar 909KB
ognl-3.0.5.jar 222KB
commons-io-2.0.1.jar 156KB
org.springframework.core-3.1.0.RELEASE.jar 432KB
org.springframework.context-3.1.0.RELEASE.jar 810KB
commons-pool-1.6.jar 109KB
slf4j-api-1.7.2.jar 25KB
commons-collections-3.1.jar 546KB
javassist-3.11.0.GA.jar 600KB
org.springframework.transaction-3.1.0.RELEASE.jar 240KB
jta-1.1.jar 11KB
org.springframework.asm-3.1.0.RELEASE.jar 52KB
web.xml 917B
.project 1KB
共 90 条
- 1
vip_wst
- 粉丝: 4
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页