资源简介

J2EE源码,与“毕业设计-计算机软件专业-旅游网站后台管理-论文”配套

资源截图

代码片段和文件信息

package com.zhang.travel.action;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;
import com.zhang.travel.model.Admin;
import com.zhang.travel.service.AdminService;

public class AdminAction extends ActionSupport implements SessionAware{

private AdminService adminService;
private Mapject> session;


private String adminName;
private String password;

/*
 *********user method begin**************
 */

public String login() throws IOException{

Admin a1 = new Admin();
a1.setAdminName(this.getAdminName());
a1.setPassword(this.getPassword());

HttpServletResponse response = ServletActionContext.getResponse();
PrintWriter pw = response.getWriter();

if(adminService.exists(a1)){
Admin a = adminService.readAdmin(a1);
session.put(“adminName“ a.getAdminName());
session.put(“lastLoginIp“ a.getLastLoginIp());
session.put(“lastLoginTime“ a.getLastLoginTime());

String ip = InetAddress.getLocalHost().getHostAddress();
a.setLastLoginIp(ip);
Date d = new Date();
String sdf = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss“).format(d);
a.setLastLoginTime(sdf);
a.setLoginCounts(a.getLoginCounts()+1);
adminService.update(a);
pw.write(“success“);
return null;
}
else{
pw.write(“the user name or password is wrong“);
return null;
}
}

/*
 *********user method end**************
 */

public AdminService getAdminService() {
return adminService;
}
@Resource(name=“adminService“)
public void setAdminService(AdminService adminService) {
this.adminService = adminService;
}
public Mapject> getSession() {
return session;
}
public void setSession(Mapject> session) {
this.session = session;
}

public String getAdminName() {
return adminName;
}

public void setAdminName(String adminName) {
this.adminName = adminName;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-02-25 15:57  TravelNetworkBManage\
     文件         645  2013-01-10 15:26  TravelNetworkBManage\.classpath
     目录           0  2013-01-10 14:24  TravelNetworkBManage\.myeclipse\
     文件         348  2013-02-23 18:50  TravelNetworkBManage\.mymetadata
     文件        1768  2013-02-23 18:42  TravelNetworkBManage\.project
     目录           0  2013-02-25 15:57  TravelNetworkBManage\.settings\
     文件         500  2013-01-10 14:24  TravelNetworkBManage\.settings\.jsdtscope
     文件        1040  2013-01-15 20:43  TravelNetworkBManage\.settings\com.genuitec.eclipse.j2eedt.core.prefs
     文件         395  2013-01-10 14:24  TravelNetworkBManage\.settings\org.eclipse.jdt.core.prefs
     文件         580  2013-02-23 18:50  TravelNetworkBManage\.settings\org.eclipse.wst.common.component
     文件         252  2013-01-10 14:24  TravelNetworkBManage\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2013-01-10 14:24  TravelNetworkBManage\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2013-01-10 14:24  TravelNetworkBManage\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2013-02-25 15:57  TravelNetworkBManage\src\
     文件        2725  2013-01-15 20:45  TravelNetworkBManage\src\beans.xml
     目录           0  2013-02-25 15:57  TravelNetworkBManage\src\com\
     目录           0  2013-02-25 15:57  TravelNetworkBManage\src\com\zhang\
     目录           0  2013-02-25 15:57  TravelNetworkBManage\src\com\zhang\travel\
     目录           0  2013-02-25 15:57  TravelNetworkBManage\src\com\zhang\travel\action\
     文件        2439  2013-02-25 14:55  TravelNetworkBManage\src\com\zhang\travel\action\AdminAction.java
     文件        3030  2013-02-25 14:24  TravelNetworkBManage\src\com\zhang\travel\action\InfoClassAction.java
     文件        7437  2013-02-25 15:23  TravelNetworkBManage\src\com\zhang\travel\action\InformationAction.java
     文件        3187  2013-02-25 14:26  TravelNetworkBManage\src\com\zhang\travel\action\LineClassAction.java
     文件        9036  2013-02-25 14:28  TravelNetworkBManage\src\com\zhang\travel\action\LineInfoAction.java
     文件        4699  2013-02-25 14:29  TravelNetworkBManage\src\com\zhang\travel\action\PictureClassAction.java
     文件        7076  2013-02-25 14:55  TravelNetworkBManage\src\com\zhang\travel\action\PictureInfoAction.java
     文件        4725  2013-02-25 14:36  TravelNetworkBManage\src\com\zhang\travel\action\TopBelongAction.java
     文件         568  2013-02-23 23:39  TravelNetworkBManage\src\com\zhang\travel\action\UndoAction.java
     文件        7570  2013-02-25 14:55  TravelNetworkBManage\src\com\zhang\travel\action\VideoAction.java
     目录           0  2013-02-25 15:57  TravelNetworkBManage\src\com\zhang\travel\dao\
     文件         213  2013-02-20 19:52  TravelNetworkBManage\src\com\zhang\travel\dao\AdminDao.java
............此处省略435个文件信息

评论

共有 条评论