jsp雇员系统代码.docx
- 文档编号:25453912
- 上传时间:2023-06-08
- 格式:DOCX
- 页数:17
- 大小:18.14KB
jsp雇员系统代码.docx
《jsp雇员系统代码.docx》由会员分享,可在线阅读,更多相关《jsp雇员系统代码.docx(17页珍藏版)》请在冰豆网上搜索。
jsp雇员系统代码
Login.jsp
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
用户名:
密 码:
Submit.jsp
<%@pagelanguage="java"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
<%Stringusername=request.getParameter("username");
Stringpassword=request.getParameter("pwd");
if(username.equals("admin")&&password.equals("000")){%>
forwardpage="main.jsp">
forward>
<%;}%>
forwardpage="fault.jsp">
forward>
Default.jsp
<%@pagelanguage="java"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
18px;text-align: center"bgcolor="#FFCBB3">雇员查询系统
100px"name="post">
120px;height: 25px;font-size: 15px"/>
<%@includefile="bottom.jsp"%>
Fault.jsp
<%@pagelanguage="java"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
Bottom.jsp
<%@pagelanguage="java"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
XX市XX街4392号|联系电话0832479 |
MySQL.jsp
<%@pagelanguage="java"import="java.sql.*"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
<%@includefile="top.jsp"%>
<%request.setCharacterEncoding("UTF-8");
Stringa=request.getParameter("name");
Stringb=request.getParameter("post");
Stringsql="selectEMP_ID,POST_NAME,EMP_NAME,EMP_SEX,EMP_AGE,EMP_DEPART,EMP_YEAR,employee.POST_IDfrompostinnerjoinemployeeonpost.POST_ID=employee.POST_IDwhereEMP_NAME='"+a+"'orpost.POST_ID='"+b+"'";
Stringsql1="selecte.EMP_ID,p.POST_NAME,e.EMP_NAME,e.EMP_SEX,e.EMP_AGE,e.EMP_DEPART,e.EMP_YEARfrompostp,employeeewherep.POST_ID=e.POST_ID";
StringdriverClass="com.mysql.jdbc.Driver";
Stringurl="jdbc:
mysql:
//localhost:
3306/handson";
Stringusername="EMPSYS";
Stringpassword="EMPSYS";
Class.forName(driverClass);
Connectionconn=DriverManager.getConnection(url,username,password);
//Statementstmt=conn.createStatement();
Statementstmt=conn.createStatement();
ResultSetrs;
if(a==""){
rs=stmt.executeQuery(sql1);
}
else{
rs=stmt.executeQuery(sql);
}
out.println("
out.println("雇员编号 雇员职位 雇员姓名 雇员性别 雇员年龄 所属部门 雇员工龄
while(rs.next())
{
out.println("
(1)+"
(2)+"
}
stmt.close();
conn.close();
rs.close();
%>
<%@includefile="bottom.jsp"%>
Top.jsp
<%@pagelanguage="java"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
<%Stringusername=request.getParameter("username");
Stringpassword=request.getParameter("pwd");
if(username.equals("admin")&&password.equals("000")){%>
forwardpage="main.jsp">
forward>
<%;}%>
forwardpage="fault.jsp">
forward>
Main.jsp
<%@pagelanguage="java"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
<%@includefile="top.jsp"%>
<%@includefile="default.jsp"%>
Index.jsp
<%@pagelanguage="java"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
varimg=document.getElementById("sdjtu");
img.onclick=function()
{
alert(Date());
}
第六章:
MyServlet.java
packagecom.dixin;
importjava.io.IOException;
importjava.io.PrintWriter;
importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
publicclassMyServletextendsHttpServlet{
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
response.setContentType("text/html;charset=gb2312");
PrintWriterout=response.getWriter();
out.println("");
out.println("
for(inti=1;i<=100;i++)
{
out.println("
+"
}
out.println("");
out.println("");
}
}
Web.xml
xmlversion="1.0"encoding="UTF-8"?
>
xsi="http: //www.w3.org/2001/XMLSchema-instance"xmlns="xsi: schemaLocation="id="WebApp_ID"version="3.0"> 第八章: Index.jsp <%@pagelanguage="java"contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%> DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http: //www.w3.org/TR/html4/loose.dtd">
姓名:
班级:
成绩:
MySQL.jsp
<%@pagelanguage="java"import="java.sql.*"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>
DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http:
//www.w3.org/TR/html4/loose.dtd">
<%request.setCharacterEncoding("UTF-8");
Stringa=request.getParameter("id");
Stringb=request.getParameter("name");
Stringc=request.getParameter("class");
Stringd=request.getParameter("scores");
StringdriverClass="com.mysql.jdbc.Driver";
Stringurl="jdbc:
mysql:
//localhost:
3306/db_02";
Stringusername="GIS";
Stringpassword="112";
Class.forName(driverClass);
Connectionconn=DriverManager.getConnection(url,username,password);
Statementstmt=conn.createStatement();
stmt.executeUpdate("insertintotb_01(学号,姓名,班级,成绩)val
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- jsp 雇员 系统 代码