Spring2.5+Struts1.3.8+Jpa(Hibernate实现)整合之八

转载请注明:来自http://changong.iteye.com/作者:张燕广

该篇主要编写jsp展示页面,这也是整合工作的最后一站。

WebRoot/Web-INF下创建文件夹pages,在该文件夹下创建学生列表展示页面studentlist.jsp,其代码如下:

 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>学生列表</title> </head> <body> <table border="2px" align="center" width="70%"> <div align="center"><h1><font color="blue">学生信息列表</font></h1></div> <div align="center"><h2><font color="blue">Spring2.5+Struts1.3.8+Jpa(Hibernate)实现</font></h2></div> <div align="right"><a href="../addStudent.jsp" mce_href="addStudent.jsp">添加学生信息</a></div> <tr> <td style="color:red" mce_style="color:red">学号</td> <td style="color:red" mce_style="color:red">姓名</td> </tr> <c:forEach items="${students}" var="student"> <tr> <td style="color:blue" mce_style="color:blue">${student.stuId }</td> <td style="color:green" mce_style="color:green">${student.stuName }</td> </tr> </c:forEach> </table> </body> </html>

WebRoot下创建添加学生信息页面addStudent.jsp,其代码如下:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>添加学生信息</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css" mce_href="styles.css"> --> </head> <h1 style="color:blue" mce_style="color:blue">请添加学生信息</h1> <body> <html:form action="/student/manage"> 姓名:<html:text property="stuName"/> <html:submit value="提交"></html:submit> <input type="hidden" name="method" value="add"/> </html:form> </body> </html>

WebRoot/Web-INF/pages下创建添加学生信息成功后的提示信息页面message.jsp,其代码如下:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>添加学生信息结果</title> </head> <body> ${message }    <a href="list.do" mce_href="list.do">查看学生信息</a> </body> </html>

    至此,Spring2.5+Struts1.3.8+Jpa的整合工作全部完成,这个整合例子虽然在service层提供了CRUD操作,但是在用户接口上尽提供了查询学生信息列表和添加学生信息的功能,如下图:

 

 

有兴趣的网友请关注后续Spring2.5+Struts2+Jpa整合的系列文章。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值