• 大小: 4.97MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-16
  • 语言: 数据库
  • 标签: struts2  

资源简介

框架使用struts2,,数据库使用mysql

资源截图

代码片段和文件信息

package com.dms.action;

import java.io.PrintWriter;
import java.util.List;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;



import com.dms.bean.Admin;
import com.dms.dao.AdminDao;
import com.opensymphony.xwork2.ActionSupport;

public class AdminAddSave extends ActionSupport {
private String Admin_Username ;
private String Admin_Password;
private String Admin_Name;
private String Admin_Sex;
private String Admin_Tel;

public String getAdmin_Username() {
return Admin_Username;
}

public void setAdmin_Username(String admin_Username) {
Admin_Username = admin_Username;
}

public String getAdmin_Password() {
return Admin_Password;
}

public void setAdmin_Password(String admin_Password) {
Admin_Password = admin_Password;
}

public String getAdmin_Name() {
return Admin_Name;
}

public void setAdmin_Name(String admin_Name) {
Admin_Name = admin_Name;
}

public String getAdmin_Sex() {
return Admin_Sex;
}

public void setAdmin_Sex(String admin_Sex) {
Admin_Sex = admin_Sex;
}

public String getAdmin_Tel() {
return Admin_Tel;
}

public void setAdmin_Tel(String admin_Tel) {
Admin_Tel = admin_Tel;
}

public String execute() throws Exception {
HttpServletResponse response=null;
response=ServletActionContext.getResponse();
response.setContentType(“text/html;charset=UTF-8“);
response.setCharacterEncoding(“UTF-8“);
PrintWriter out = response.getWriter();
HttpSession session = ServletActionContext.getRequest().getSession();//获取用户的会话对象
if(session.getAttribute(“id“)==null){
out.print(“ript language=‘javascript‘>alert(‘请重新登录!‘);window.location=‘Login.jsp‘;ript>“);
out.flush();
out.close();
return null;
}
//查询名称是否存在
List list=new AdminDao().GetList(“Admin_Username=‘“+Admin_Username+“‘“ ““);
if(list.size()>0)
{
out.print(“ript language=‘javascript‘>alert(‘名称已经存在!‘);history.back(-1);ript>“);
out.flush();
out.close();
return null;
}
Admin cnbean=new Admin();
cnbean.setAdmin_Username(Admin_Username);
cnbean.setAdmin_Password(Admin_Password);
cnbean.setAdmin_Name(Admin_Name);
cnbean.setAdmin_Sex(Admin_Sex);
cnbean.setAdmin_Tel(Admin_Tel);
new AdminDao().Add(cnbean);
    
out.print(“ript language=‘javascript‘>alert(‘添加成功!‘);window.location=‘AdminManager.action‘;ript>“);
out.flush();
out.close();
return null;

}

private boolean isInvalid(String value) {
return (value == null || value.length() == 0);
}

}




 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1755  2015-10-21 21:19  DormitoryMangersSys\.classpath

     文件       1268  2014-10-22 00:06  DormitoryMangersSys\.project

     文件        503  2013-04-28 15:29  DormitoryMangersSys\.settings\.jsdtscope

     文件        118  2014-10-22 21:27  DormitoryMangersSys\.settings\org.eclipse.core.resources.prefs

     文件        395  2013-04-28 15:29  DormitoryMangersSys\.settings\org.eclipse.jdt.core.prefs

     文件        487  2014-10-22 00:06  DormitoryMangersSys\.settings\org.eclipse.wst.common.component

     文件        345  2013-04-28 15:29  DormitoryMangersSys\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2013-04-28 15:29  DormitoryMangersSys\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2013-04-28 15:29  DormitoryMangersSys\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       3841  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\AdminAddSave.class

     文件       2192  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\AdminDel.class

     文件       3657  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\AdminLog.class

     文件       3539  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\AdminLogList.class

     文件       2900  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\AdminManager.class

     文件       2395  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\AdminUpdate.class

     文件       4217  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\AdminUpdateSave.class

     文件       3189  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\BuildingAddSave.class

     文件       2201  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\BuildingDel.class

     文件       2919  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\BuildingManager.class

     文件       2429  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\BuildingUpdate.class

     文件       3582  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\BuildingUpdateSave.class

     文件       2376  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\DomitoryAdd.class

     文件       4054  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\DomitoryAddSave.class

     文件       2201  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\DomitoryDel.class

     文件       3938  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\DomitoryManager.class

     文件       3047  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\DomitoryUpdate.class

     文件       4390  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\DomitoryUpdateSave.class

     文件       2677  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\GoLogin.class

     文件       2397  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\LogAdd.class

     文件       2930  2016-01-19 16:21  DormitoryMangersSys\build\classes\com\dms\action\LogAddSave.class

............此处省略244个文件信息

评论

共有 条评论