java应用程序综合实践报告格式任务书Word格式.docx
- 文档编号:18493409
- 上传时间:2022-12-17
- 格式:DOCX
- 页数:14
- 大小:271.87KB
java应用程序综合实践报告格式任务书Word格式.docx
《java应用程序综合实践报告格式任务书Word格式.docx》由会员分享,可在线阅读,更多相关《java应用程序综合实践报告格式任务书Word格式.docx(14页珍藏版)》请在冰豆网上搜索。
UTF-8"
>
beans
xmlns="
http:
//www.springframework.org/schema/beans"
xmlns:
xsi="
//www.w3.org/2001/XMLSchema-instance"
aop="
//www.springframework.org/schema/aop"
tx="
//www.springframework.org/schema/tx"
xsi:
schemaLocation="
//www.springframework.org/schema/beans
http:
//www.springframework.org/schema/beans/spring-beans-2.5.xsd"
//www.springframework.org/schema/tx
//www.springframework.org/schema/tx/spring-tx.xsd"
//www.springframework.org/schema/aop
//www.springframework.org/schema/aop/spring-aop.xsd"
<
beanid="
dataSource"
class="
mons.dbcp.BasicDataSource"
propertyname="
driverClassName"
value="
com.mysql.jdbc.Driver"
/property>
url"
value="
jdbc:
mysql:
//localhost:
3306/testDB?
useUnicode=true&
amp;
characterEncoding=utf8"
username"
root"
password"
"
sessionFactory"
class="
org.springframework.orm.hibernate3.LocalSessionFactoryBean"
refbean="
/>
<
hibernateProperties"
props>
propkey="
hibernate.dialect"
org.hibernate.dialect.MySQLDialect<
/prop>
hibernate.show_sql"
true<
/props>
mappingResources"
list>
value>
cn/edu/zstu/model/Student.hbm.xml<
/value>
/list>
/bean>
/beans>
Classdao:
packagecn.edu.zstu.dao;
importjava.util.List;
importcn.edu.zstu.model.Student;
publicinterfacestuMgrDAO{
publicvoidadd(Students);
publicStudentgetStudent(Integerid);
publicList<
Student>
getStudents();
publicvoidupdate(Students);
publicvoiddelete(Integerid);
}
packagecn.edu.zstu.dao.impl;
importorg.springframework.orm.hibernate3.support.HibernateDaoSupport;
importcn.edu.zstu.dao.StudentDAO;
publicclassStudentDAOImplextendsHibernateDaoSuportimplementsStudentDAO{
publicvoidadd(Students){
getHibernateTemplate().save(s);
}
publicvoiddelete(Integerid){
getHibernateTemplate().delete(getStudent(id));
publicStudentgetStudent(Integerid){
return(Student)getHibernateTemplate().get(Student.class,id);
@SuppressWarnings("
unchecked"
)
getStudents(){
returngetHibernateTemplate().find("
fromStudentorderbyiddesc"
);
publicvoidupdate(Students){
getHibernateTemplate().update(s);
packagecn.edu.zstu.service:
packagecn.edu.zstu.service;
publicinterfaceStudentService{
publicvoidaddStudent(Students);
getStudents();
publicvoidupdateStudent(Students);
publicvoiddeleteStudent(Integerid);
classStudentServiceImplimplementsStudentService:
packagecn.edu.zstu.service.Impl;
importcn.edu.zstu.service.StudentService;
publicclassStudentServiceImplimplementsStudentService{
privateStudentDAOstudentDao;
publicvoidaddStudent(Students){
studentDao.add(s);
publicvoiddeleteStudent(Integerid){
studentDao.delete(id);
returnstudentDao.getStudent(id);
getStidents(){
returnstudentDao.getStudents();
publicvoidupdateStudent(Students){
studentDao.update(s);
publicStudentDAOgetStudentDao(){
returnstudentDao;
publicvoidsetStudentDao(StudentDAOstudentDao){
this.studentDao=studentDao;
packagecn.edu.zstu.action;
importcom.opensymphony.xwork2.ActionSupport;
publicclassStudentActionextendsActionSupport{
privatestaticfianllongserialVersionUID=1L;
privateStudentServicestudentService;
privateStudentstudent;
privateList<
students;
privateIntegerid;
publicStudentgetStudent(){
returnstudent;
publicvoidsetStudent(Studentstudent){
this.student=student;
publicIntegergetId(){
returnid;
publicvoidsetId(Integerid){
this.id=id;
returnstudents;
publicvoidsetStudentService(StudentServicestudentService){
this.studentService=studentService;
publicStringadd(){
studentService.addStudent(student);
returnSUCCESS;
publicStringlist(){
this.students=studentService.getStudents();
publicStringdelete(){
studentService.deleteStudent(id);
publicStringupdate(){
studentService.updateStudent(student);
publicStringgetById(){
student=studentService.getStudent(id);
!
DOCTYPEstrutsPUBLIC
"
-//ApacheSoftwareFoundation//DTDStrutsConfiguration2.0//EN"
//struts.apache.org/dtds/struts-2.0.dtd"
struts>
constantname="
struts.objectFactory"
spring"
struts.enable.DynamicMethodInvocation"
false"
struts.devMode"
true"
struts.i18n.encoding"
GBK"
includefile="
struts-default.xml"
packagename="
default"
extends="
struts-default"
actionname="
add"
studentBean"
method="
resultname="
success"
type="
redirect"
list.action<
/result>
/action>
list"
list.jsp<
delete"
get"
getById"
result>
update.jsp<
update"
/package>
/struts>
add.jsp
%@pagelanguage="
java"
import="
java.util.*"
pageEncoding="
GB18030"
%>
%@tagliburi="
/struts-tags"
prefix="
s"
html>
head>
title>
Addpage<
/title>
/head>
body>
center>
H2>
s:
textname="
新增学生"
/s:
text>
/H2>
formaction="
post"
textfieldlabel="
姓名"
name="
student.name"
性别"
student.gender"
年龄"
student.age"
submit>
form>
/center>
/body>
/html>
list.jsp
DOCTYPEHTMLPUBLIC"
-//W3C//DTDHTML4.01Transitional//EN"
h3>
输出列表信息<
/h3>
br>
h4>
ahref="
../StuMgr/add.jsp"
学生注册<
/a>
/h4>
theme="
simple"
table>
thead>
tr>
th>
选择<
/th>
编号<
姓名<
性别<
年龄<
操作<
/thead>
tbody>
iteratorvalue="
students"
td>
inputtype="
checkbbox"
id"
value='
propertyvalue="
'
/td>
name"
gender"
age"
ahref='
urlactionn="
paramname="
/<
url>
修改<
&
nbsp;
删除<
/tr>
iterator>
/tbody>
/table>
update.jsp
javapageEncoding="
@tagliburi="
DOCTYPEHTMLPUBLIC"
修改信息<
h2>
/h2>
hr/>
update.action"
hiddenname="
student.id"
name="
submitvalue="
修改"
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 应用程序 综合 实践 报告 格式 任务书
![提示](https://static.bdocx.com/images/bang_tan.gif)