jsp+serlvet增删改查员工系统
标签:
•
文件类型: .rar
•
文件大小: 1.36MB
•
下载次数: 1
•
jsp+serlvet实现的增删改查员工管理系统,后台使用Mysql
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1278 2018-01-14 14:14 customer.classpath
文件 297 2013-12-24 13:08 customer.mymetadata
文件 1751 2013-12-24 13:35 customer.project
文件 500 2013-12-24 13:08 customer.settings.jsdtscope
文件 247 2018-01-13 15:27 customer.settingscom.genuitec.eclipse.migration.prefs
文件 395 2013-12-24 13:08 customer.settingsorg.eclipse.jdt.core.prefs
文件 550 2018-01-14 10:50 customer.settingsorg.eclipse.wst.common.component
文件 359 2018-01-13 15:27 customer.settingsorg.eclipse.wst.common.project.facet.core.xml
文件 49 2013-12-24 13:08 customer.settingsorg.eclipse.wst.jsdt.ui.superType.container
文件 6 2013-12-24 13:08 customer.settingsorg.eclipse.wst.jsdt.ui.superType.name
文件 556 2018-01-14 11:53 customersrcc3p0-config.xml
文件 2585 2018-01-14 15:13 customersrccomwtucontrolleraseServlet.java
文件 2549 2018-01-14 16:08 customersrccomwtucontrollerCustomerServlet.java
文件 3491 2018-01-14 16:03 customersrccomwtudaoCustomerDao.java
文件 1743 2018-01-14 14:43 customersrccomwtuentityCustomer.java
文件 920 2018-01-14 15:48 customersrccomwtuentityPageBean.java
文件 668 2018-01-14 15:59 customersrccomwtuserviceCustomerService.java
文件 471 2018-01-14 10:25 customersrccomwtuutilsDateUtil.java
文件 1219 2018-01-14 10:55 customersrccomwtuutilsJDBCUtils.java
文件 25 2018-01-13 15:27 customersrcmeta-INFMANIFEST.MF
文件 3543 2018-01-14 11:16 customerWebRootadd.jsp
文件 3460 2013-12-24 14:46 customerWebRootedit.jsp
文件 781 2013-12-24 14:45 customerWebRootframe.jsp
文件 105 2013-12-24 13:38 customerWebRootindex.jsp
文件 919 2013-12-24 13:49 customerWebRootjquerycalendar-green.gif
文件 269 2013-12-24 13:49 customerWebRootjquerycalendar.gif
文件 94 2013-12-24 13:49 customerWebRootjquerycalendar.js
文件 216840 2013-12-24 13:49 customerWebRootjqueryjquery-1.5.1.js
文件 1427 2013-12-24 13:49 customerWebRootjqueryjquery.datepick-zh-CN.js
文件 4008 2013-12-24 13:49 customerWebRootjqueryjquery.datepick.css
............此处省略54个文件信息
package com.wtu.controller;
import java.io.IOException;
import java.lang.reflect.Method;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class baseServlet extends HttpServlet{
@Override
public void service(HttpServletRequest req HttpServletResponse resp)
throws ServletException IOException {
resp.setContentType(“text/html;charset=UTF-8“);//处理响应编码
req.setCharacterEncoding(“UTF-8“);
/*
* 通过反射来实现,
* 1获取方法名
* 2.获取当前类Class对象 this.getClass();
* 3.获取与该方法名对应的Method对象 getMethod(String name Class>... parameterTypes)
String name:方法名
Class>... parameterTypes:方法的参数类型 HttpServletRequest.class HttpServletResponse.class
* 4.通过Method对象来调用invoke(thisreqresp) 就相当于调用了 methodName()
* 假设获取的methodName 为 addCustomer
*/
//获取请求方法 在请求参数中 附带一个额外的参数 :该参数是一个方法名
String methodName = req.getParameter(“method“);
//获取当前类的Class对象
Class cl = this.getClass();
//获取与methodName 对应的Method对象、
Method method = null;
try {
method = cl.getMethod(methodName HttpServletRequest.classHttpServletResponse.class);
} catch (Exception e) {
throw new RuntimeException(“不能获取“+methodName+“的Method对象“);
}
String path = null;
try {
//通过method对象来调用invoke() 方法 该方法的返回值就是执行methodName()返回值
//this.methodName(reqresp);
path = (String)method.invoke(this reqresp);//采用反射调用
} catch (Exception e) {
e.printStackTrace();
}
if (path == null) {
System.out.println(“什么也不做!!!“);
return ;
}
/*
* 在此处转发或者重定向
*/
String[] arr = path.split(“:“);
/*
* 判断arr[0]如果是redirect 那么久重定向,如果是forward 那么久转发 如果是null 那就什么都不做
* 如果是其他那么久抛个异常,提示不能进行此操作
*/
if(“redirect“.equals(arr[0])){
resp.sendRedirect(req.getContextPath()+arr[1]);
}else if(“forward“.equals(arr[0])){
req.getRequestDispatcher(arr[1]).forward(req resp);
}else {
throw new RuntimeException(“操作有误,只能转发或者重定向,或者什么也不做“);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1278 2018-01-14 14:14 customer.classpath
文件 297 2013-12-24 13:08 customer.myme
文件 1751 2013-12-24 13:35 customer.project
文件 500 2013-12-24 13:08 customer.settings.jsdtscope
文件 247 2018-01-13 15:27 customer.settingscom.genuitec.eclipse.migration.prefs
文件 395 2013-12-24 13:08 customer.settingsorg.eclipse.jdt.core.prefs
文件 550 2018-01-14 10:50 customer.settingsorg.eclipse.wst.common.component
文件 359 2018-01-13 15:27 customer.settingsorg.eclipse.wst.common.project.facet.core.xm
文件 49 2013-12-24 13:08 customer.settingsorg.eclipse.wst.jsdt.ui.superType.container
文件 6 2013-12-24 13:08 customer.settingsorg.eclipse.wst.jsdt.ui.superType.name
文件 556 2018-01-14 11:53 customersrcc3p0-config.xm
文件 2585 2018-01-14 15:13 customersrccomwtucontrollera
文件 2549 2018-01-14 16:08 customersrccomwtucontrollerCustomerServlet.java
文件 3491 2018-01-14 16:03 customersrccomwtudaoCustomerDao.java
文件 1743 2018-01-14 14:43 customersrccomwtuentityCustomer.java
文件 920 2018-01-14 15:48 customersrccomwtuentityPageBean.java
文件 668 2018-01-14 15:59 customersrccomwtuserviceCustomerService.java
文件 471 2018-01-14 10:25 customersrccomwtuutilsDateUtil.java
文件 1219 2018-01-14 10:55 customersrccomwtuutilsJDBCUtils.java
文件 25 2018-01-13 15:27 customersrcme
文件 3543 2018-01-14 11:16 customerWebRootadd.jsp
文件 3460 2013-12-24 14:46 customerWebRootedit.jsp
文件 781 2013-12-24 14:45 customerWebRootfr
文件 105 2013-12-24 13:38 customerWebRootindex.jsp
文件 919 2013-12-24 13:49 customerWebRootjquerycalendar-green.gif
文件 269 2013-12-24 13:49 customerWebRootjquerycalendar.gif
文件 94 2013-12-24 13:49 customerWebRootjquerycalendar.js
文件 216840 2013-12-24 13:49 customerWebRootjqueryjquery-1.5.1.js
文件 1427 2013-12-24 13:49 customerWebRootjqueryjquery.datepick-zh-CN.js
文件 4008 2013-12-24 13:49 customerWebRootjqueryjquery.datepick.css
............此处省略54个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)