javaee 期末考查报告要求.docx
《javaee 期末考查报告要求.docx》由会员分享,可在线阅读,更多相关《javaee 期末考查报告要求.docx(161页珍藏版)》请在冰豆网上搜索。
javaee期末考查报告要求
考查课程报告
课程名称:
JavaEE技术
学院:
信息工程与自动化学院
专业年级:
2010级计算机系班
学号:
学生姓名:
指导教师:
日期:
2012-12-30
期末考查结果评定
评分项目
分值
得分
报告条理清晰,内容详实,体会深刻
40
报告格式符合规范
10
程序符合要求
40
界面美观,功能有扩充
10
评语:
成绩:
指导教师签字:
评定日期:
年月日
1课程目的……………………………………………………………1
2要求与内容……………………………………………………………1
3运行环境……………………………………………………………1
4设计及实现……………………………………………………………1
5程序运行截图……………………………………………………………………88
6.总结和体会……………………………………………………………………90
7.参考文献…………………………………………………………………………91
1.课程目的
学生通过学习该课程后,着重应掌握跨平台WEB编程技术的知识和技能,主要掌握jsp、Servlet、JavaBean、JDBC、数据库连接池、MyEclipse环境、EL、JSTL核心标签库、TOMCAT容器、MVC架构等基本知识和基本技能,在知识、能力和素质等方面达到能够独立的从事WEB服务器架构和服务器端软件开发的目标,本课程在人才培养过程中占有重要的不可替代的地位及作用,它把各专业基础知识综合在一起,形成一个培养提高学生专业能力的好课程,为同学走向社会、就业等奠定了坚实的自信心和牢固专业知识,极大地提高同学在社会就业竞争中的竞争力。
2.要求与内容
按照MVC设计模式,以5层的分层结构设计实现……管理。
数据表需自行设计建立,数据库连接采用连接池的方式;view层主要以JSP页面方式实现,在页面中采用EL、JSTL标签库,并采用页面组装的方式合成top、left、bottom区域的内容;Control层用Servlet实现;Model层用分层方式实现,分为VALUE类、DAO的接口、接口实现类和工厂、Business的接口、接口实现类和工厂,数据库连接工厂。
3.运行环境
MyEclipse10,SQLserver2008
4.设计及实现
1、com.city.oa.action
(1)EmployeeAddAction
packagecom.city.oa.action;
importjava.io.IOException;
importjava.io.PrintWriter;
importjava.util.List;
importjavax.servlet.RequestDispatcher;
importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
importcom.city.oa.business.IEmployee;
importcom.city.oa.factory.BussinessFactory;
importcom.city.oa.value.EmployeeValue;
publicclassEmployeeAddActionextendsHttpServlet{
/**
*Constructoroftheobject.
*/
publicEmployeeAddAction(){
super();
}
/**
*Destructionoftheservlet.
*/
publicvoiddestroy(){
super.destroy();//Justputs"destroy"stringinlog
//Putyourcodehere
}
/**
*ThedoGetmethodoftheservlet.
*
*Thismethodiscalledwhenaformhasitstagvaluemethodequalstoget.
*
*@paramrequesttherequestsendbytheclienttotheserver
*@paramresponsetheresponsesendbytheservertotheclient
*@throwsServletExceptionifanerroroccurred
*@throwsIOExceptionifanerroroccurred
*/
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
Stringuserid=request.getParameter("userid");
Stringname=request.getParameter("name");
Stringpassword=request.getParameter("password");
StringageString=request.getParameter("age");
intage=Integer.parseInt(ageString);
try{
IEmployeeemp=BussinessFactory.getEmployee();
emp.add(userid,name,password,age);
}catch(Exceptione){
Stringmess=e.getMessage();
response.sendRedirect("employee/error.jsp?
mess="+mess);
}
}
/**
*ThedoPostmethodoftheservlet.
*
*Thismethodiscalledwhenaformhasitstagvaluemethodequalstopost.
*
*@paramrequesttherequestsendbytheclienttotheserver
*@paramresponsetheresponsesendbytheservertotheclient
*@throwsServletExceptionifanerroroccurred
*@throwsIOExceptionifanerroroccurred
*/
publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
doGet(request,response);
}
/**
*Initializationoftheservlet.
*
*@throwsServletExceptionifanerroroccurs
*/
publicvoidinit()throwsServletException{
//Putyourcodehere
}
}
(2)EmployeeDeleteAction
packagecom.city.oa.action;
importjava.io.IOException;
importjava.io.PrintWriter;
importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
importcom.city.oa.business.IEmployee;
importcom.city.oa.dao.impl.EmployeeDaoImpl;
importcom.city.oa.factory.BussinessFactory;
publicclassEmployeeDeleteActionextendsHttpServlet{
/**
*Constructoroftheobject.
*/
publicEmployeeDeleteAction(){
super();
}
/**
*Destructionoftheservlet.
*/
publicvoiddestroy(){
super.destroy();//Justputs"destroy"stringinlog
//Putyourcodehere
}
/**
*ThedoGetmethodoftheservlet.
*
*Thismethodiscalledwhenaformhasitstagvaluemethodequalstoget.
*
*@paramrequest
*therequestsendbytheclienttotheserver
*@paramresponse
*theresponsesendbytheservertotheclient
*@throwsServletException
*ifanerroroccurred
*@throwsIOException
*ifanerroroccurred
*/
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
Stringuserid=request.getParameter("userid");
Stringname=request.getParameter("name");
Stringpassword=request.getParameter("password");
StringageStr=request.getParameter("age");
intage=Integer.parseInt(ageStr);
try{
IEmployeeemp=BussinessFactory.getEmployee();
emp.delete(userid,name,password,age);
}catch(Exceptione){
Stringmess=e.getMessage();
response.sendRedirect("employee/error.jsp?
mess="+mess);
}
//获得删除超链接传来的参数
StringsId=request.getParameter("userid");
intid=Integer.parseInt(sId);
//调用模型层删除方法
Stringsql="deletefromuserinfowhereuserid=?
";
EmployeeDaoImplsBean=newEmployeeDaoImpl();
intcount=sBean.getDelete(sql,id);
Stringurl="";
if(count>0){
url="employee/SearchList.jsp";
}else{
url="employee/error.jsp";
request.setAttribute("error","删除");
}
request.getRequestDispatcher(url).forward(request,response);
}
/**
*ThedoPostmethodoftheservlet.
*
*Thismethodiscalledwhenaformhasitstagvaluemethodequalsto
*post.
*
*@paramrequest
*therequestsendbytheclienttotheserver
*@paramresponse
*theresponsesendbytheservertotheclient
*@throwsServletException
*ifanerroroccurred
*@throwsIOException
*ifanerroroccurred
*/
publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
doGet(request,response);
}
/**
*Initializationoftheservlet.
*
*@throwsServletException
*ifanerroroccurs
*/
publicvoidinit()throwsServletException{
//Putyourcodehere
}
}
(3)EmployeeInsertAction
packagecom.city.oa.action;
importjava.io.IOException;
importjava.io.PrintWriter;
importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
importcom.city.oa.business.IEmployee;
importcom.city.oa.factory.BussinessFactory;
importcom.city.oa.value.EmployeeValue;
publicclassEmployeeInsertActionextendsHttpServlet{
/**
*Constructoroftheobject.
*/
publicEmployeeInsertAction(){
super();
}
/**
*Destructionoftheservlet.
*/
publicvoiddestroy(){
super.destroy();//Justputs"destroy"stringinlog
//Putyourcodehere
}
/**
*ThedoGetmethodoftheservlet.
*
*Thismethodiscalledwhenaformhasitstagvaluemethodequalstoget.
*
*@paramrequesttherequestsendbytheclienttotheserver
*@paramresponsetheresponsesendbytheservertotheclient
*@throwsServletExceptionifanerroroccurred
*@throwsIOExceptionifanerroroccurred
*/
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
//获取前台页面信息
Stringuserid=request.getParameter("userid");
Stringname=request.getParameter("name");
Stringpassword=request.getParameter("password");
Stringsex=request.getParameter("sex");
StringSage=request.getParameter("age");
intage=Integer.parseInt(Sage);
//封装到JavaBean对象中
com.city.oa.value.EmployeeValue
jBean=newcom.city.oa.value.EmployeeValue();
jBean.setName(name);
jBean.setPassword(password);
jBean.setSex(sex);
jBean.setAge(age);
//调用模型层
Stringsql="insertintouserinfovalues(?
?
?
?
)";
IEmployeeemp=BussinessFactory.getEmployee();
EmployeeInsertActionsBean=newEmployeeInsertAction();
intcount=sBean.getInsert(sql,jBean);
Stringurl="";if(count>0){
url="employee/SearchList.jsp";
}
else{
url="employee/error.jsp";
request.setAttribute("error","注册");}
//转发
request.getRequestDispatcher(url).forward(request,response);
}
privateintgetInsert(Stringsql,EmployeeValuejBean){
//TODOAuto-generatedmethodstub
return0;
}
/**
*ThedoPostmethodoftheservlet.
*
*Thismethodiscalledwhenaformhasitstagvaluemethodequalstopost.
*
*@paramrequesttherequestsendbytheclienttotheserver
*@paramresponsetheresponsesendbytheservertotheclient
*@throwsServletExceptionifanerroroccurred
*@throwsIOExceptionifanerroroccurred
*/
publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)
throwsServletException,IOException{
doGet(request,response);
}
/**
*Initializationoftheservlet.
*
*@throwsServletExceptionifanerroroccurs
*/
publicvoidinit()throwsServletException{
//Putyourcodehere
}
}
(4)EmployeeMainAction
packagecom.city.oa.action;
importjava.io.IOException;
importjava.io.PrintWriter;
importjava.util.*;
importcom.city.oa.business.*;
importcom.city.oa.factory.*;
importcom.city.oa.value.EmployeeValue;
importjavax.servlet.RequestDispatcher;
importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
publicclassEmployeeMainActionextendsHttpServlet{
/**
*Constructoroftheobject.
*/
pub