package com.seventh.action.pub;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.seventh.entity.Admin;
import com.seventh.entity.Config;
import com.seventh.entity.Field;
import com.seventh.entity.Notice;
import com.seventh.entity.Page;
import com.seventh.entity.Position;
import com.seventh.entity.Student;
import com.seventh.entity.Teacher;
import com.seventh.service.AdminService;
import com.seventh.service.ConfigService;
import com.seventh.service.FieldService;
import com.seventh.service.NoticeService;
import com.seventh.service.PositionService;
import com.seventh.service.StudentService;
import com.seventh.service.TeacherService;
import com.seventh.util.MD5Util;
import com.seventh.util.PageUtil;
@SuppressWarnings("serial")
public class LoginAction extends ActionSupport{
private String id;
private String password;
private String message;
private Page loginNoticePage;
private AdminService adminService;
private TeacherService teacherService;
private StudentService studentService;
private NoticeService noticeService;
private FieldService fieldService;
private PositionService positionService;
private ConfigService configService;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Page getLoginNoticePage() {
return loginNoticePage;
}
public void setLoginNoticePage(Page loginNoticePage) {
this.loginNoticePage = loginNoticePage;
}
public AdminService getAdminService() {
return adminService;
}
public void setAdminService(AdminService adminService) {
this.adminService = adminService;
}
public TeacherService getTeacherService() {
return teacherService;
}
public void setTeacherService(TeacherService teacherService) {
this.teacherService = teacherService;
}
public StudentService getStudentService() {
return studentService;
}
public void setStudentService(StudentService studentService) {
this.studentService = studentService;
}
public NoticeService getNoticeService() {
return noticeService;
}
public void setNoticeService(NoticeService noticeService) {
this.noticeService = noticeService;
}
public FieldService getFieldService() {
return fieldService;
}
public void setFieldService(FieldService fieldService) {
this.fieldService = fieldService;
}
public PositionService getPositionService() {
return positionService;
}
public void setPositionService(PositionService positionService) {
this.positionService = positionService;
}
public ConfigService getConfigService() {
return configService;
}
public void setConfigService(ConfigService configService) {
this.configService = configService;
}
public String execute(){
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
session.removeAttribute("logintype");
session.removeAttribute("student");
session.removeAttribute("teacher");
session.removeAttribute("admin");
Config config=this.getConfigService().init();
Student studentLogin = studentService.findStudentById(getId());
if (studentLogin != null) {
if(studentLogin.getPassword().equals(MD5Util.md5(getPassword())))
{
int totalCount=this.noticeService.noticeCounts("0","0");
loginNoticePage=PageUtil.createPage(10, totalCount, 0);
List<Notice> notices=this.noticeService.queryByPage(loginNoticePage);
session.setAttribute("loginIndexnotices", notices);
session.setAttribute("loginNoticePage", loginNoticePage);
session.setAttribute("student", studentLogin);
session.setAttribute("logintype", "student");
session.setAttribute("config", config);
message="登录成功!";
return "stuLogin";
}
else
{
message="密码不正确,请认真核实。";
return INPUT;
}
}
else
{
Teacher teacherLogin = teacherService.findTeacherById(id);
if (teacherLogin != null) {
if(teacherLogin.getPassword().equals(MD5Util.md5(getPassword())))
{
int totalCount=this.noticeService.noticeCounts("0","0");
loginNoticePage=PageUtil.createPage(10, totalCount, 0);
List<Notice> notices=this.noticeService.queryByPage(loginNoticePage);
Position position=this.getPositionService().findPositionById(teacherLogin.getPositionId());
Field field=this.getFieldService().findFieldById(teacherLogin.getFieldId());
session.setAttribute("loginIndexnotices", notices);
session.setAttribute("loginNoticePage", loginNoticePage);
session.setAttribute("teacher", teacherLogin);
session.setAttribute("logintype", "teacher");
session.setAttribute("config", config);
session.setAttribute("position", position);
session.setAttribute("field", field);
message="登录成功!";
return "teaLogin";
}
else
{
message="密码不正确,请认真核实。";
return INPUT;
}
}
else
{
Admin adminLogin = adminService.findAdminById(id);
if(adminLogin!=null)
{
if(adminLogin.getPassword().equals(MD5Util.md5(getPassword())))
{
int totalCount=this.noticeService.noticeCounts("0","0");
loginNoticePage=PageUtil.createPage(10, totalCount, 0);
List<Notice> notices=this.noticeService.queryByPage(loginNoticePage);
session.setAttribute("loginIndexnotices", notices);
session.setAttribute("loginNoticePage", loginNoticePage);
session.setAttribute("admin", adminLogin);
session.setAttribute("logintype", "admin");
session.setAttribute("config", config);
message="登录成功!";
return "adminLogin";
}
else
{
message="密码不正确,请认真核实。";
return INPUT;
}
}
else{
message="没有此账号,请认真核实。";
return INPUT;
}
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
个人花大量时间整理出的真实毕业设计实战成果,内容丰富,文档也很详细。无论做毕业设计还是用于学习技能,或工作中当做参考资料,都能发挥重要作用 亲们下载我任何一个付费资源后,即可私信联系我免费下载其他相关资源哦~ 个人花大量时间整理出的真实毕业设计实战成果,内容丰富,文档也很详细。无论做毕业设计还是用于学习技能,或工作中当做参考资料,都能发挥重要作用 亲们下载我任何一个付费资源后,即可私信联系我免费下载其他相关资源哦~ 个人花大量时间整理出的真实毕业设计实战成果,内容丰富,文档也很详细。无论做毕业设计还是用于学习技能,或工作中当做参考资料,都能发挥重要作用 亲们下载我任何一个付费资源后,即可私信联系我免费下载其他相关资源哦~
资源推荐
资源详情
资源评论
收起资源包目录
《毕业设计》--毕业论文选题系统的设计与实现.zip (561个子文件)
ueditor.css 43KB
ueditor.min.css 34KB
video-js.css 21KB
image.css 18KB
video.css 15KB
attachment.css 14KB
video-js.min.css 11KB
style.css 9KB
login.css 7KB
shCoreDefault.css 7KB
scrawl.css 4KB
codemirror.css 3KB
charts.css 3KB
background.css 2KB
emotion.css 2KB
dialogbase.css 2KB
music.css 2KB
edittable.css 1KB
template.css 1KB
webuploader.css 515B
reset.css 481B
help.css 389B
iframe.css 41B
vjs.eot 3KB
UEditorSnapscreen.exe 508KB
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
icons.gif 20KB
file-icons.gif 20KB
file-icons.gif 20KB
tface.gif 19KB
fface.gif 18KB
cface.gif 8KB
icons-all.gif 4KB
videologo.gif 2KB
cancelbutton.gif 1KB
button-bg.gif 1KB
lock.gif 1KB
alignicon.gif 1KB
word.gif 1019B
icon_doc.gif 1012B
icon_psd.gif 1009B
icon_rar.gif 1007B
icon_xls.gif 1005B
icon_ppt.gif 1001B
icon_mv.gif 1001B
icon_pdf.gif 996B
icon_mp3.gif 986B
icon_txt.gif 970B
icon_jpg.gif 950B
icon_exe.gif 949B
icon_chm.gif 923B
loading.gif 734B
icons.gif 453B
icons.gif 453B
icons.gif 453B
success.gif 445B
success.gif 445B
success.gif 445B
cursor_v.gif 370B
cursor_h.gif 253B
anchor.gif 184B
unhighlighted.gif 111B
highlighted.gif 111B
dot.gif 102B
bg.gif 84B
pagebreak.gif 54B
spacer.gif 43B
0.gif 43B
.gitignore 74B
wordimage.html 6KB
map.html 6KB
emotion.html 6KB
image.html 5KB
show.html 5KB
charts.html 5KB
link.html 4KB
insertframe.html 4KB
video.html 4KB
searchreplace.html 4KB
gmap.html 4KB
scrawl.html 4KB
background.html 3KB
help.html 3KB
edittable.html 2KB
webapp.html 2KB
attachment.html 2KB
snapscreen.html 2KB
anchor.html 2KB
edittd.html 2KB
preview.html 1KB
music.html 950B
template.html 922B
edittip.html 863B
spechars.html 829B
login.html 211B
hibernate3.jar 3.95MB
struts2-dojo-plugin-2.2.3.1.jar 1.65MB
共 561 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
季风泯灭的季节
- 粉丝: 639
- 资源: 2920
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功