HardBirch

Spring2.5+Struts2+Jpa(Hibernate实现)整合之四

时间:09-05-15 栏目:iOS移动应用开发技术 作者:张飞不张,文采横飞 评论:2 点击: 2,616 次

改篇主要编写JSP展示页面。

WebRoot/WEB-INF下创建文件夹pages,在该文件夹下分别创建如下4JSP页面:

1.学生信息列表页面:studentlist.jsp

其代码如下:

 


































2.添加学生信息页面:addStudent.jsp

       其代码如下:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" mce_href="styles.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
-->
</head>
<h1 style="color:blue" mce_style="color:blue">请添加学生信息</h1>
<body>
<s:form action="action_save">
学生姓名:<s:textfield name="student.stuName" value=""/>
<s:submit value="提交"/>
</s:form>
</body>
</html>


3.学生信息添加结果页面:message.jsp

       其代码如下:












4.修改学生信息页面:editStudent.jsp

       其代码如下:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" mce_href="styles.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
-->
</head>
<h1 style="color:blue" mce_style="color:blue">请修改学生信息</h1>
<body>
<s:form action="action_save">
学生姓名:<s:textfield name="student.stuName"/>
<s:submit value="提交"/>
</s:form>
</body>
</html>

修改index.jsp页面,修改后的代码如下:





<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>" rel="external nofollow" >

<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" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" mce_href="styles.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >
-->
</head>
<h1>学生信息管理</h1>
<body>
<a href="student/action_list.action" rel="external nofollow" rel="external nofollow" mce_href="student/action_list.action" rel="external nofollow" rel="external nofollow" >查看学生信息</a>
</body>
</html>


至此,Spring2.5+Struts2+Jpa(Hibernate实现)的整合工作全部完成。这个小的整合项目实现了CRUD操作,如下图:

有兴趣的读者请关注后续Spring2.5+Struts2+Hibernate3整合的系列文章。

 

声明: 本文由( 张飞不张,文采横飞 )原创编译,转载请保留链接: Spring2.5+Struts2+Jpa(Hibernate实现)整合之四

Spring2.5+Struts2+Jpa(Hibernate实现)整合之四:目前有2 条留言

  1. 板凳
    szbobos:

    我在取值时为何总是出错啊:
    Struts Problem Report
    Struts has detected an unhandled exception:

    Messages: com.opensymphony.xwork2.util.ValueStack.findValue(Ljava/lang/String;Z)Ljava/lang/Object;
    java.lang.NoSuchMethodError: com.opensymphony.xwork2.util.ValueStack.findValue(Ljava/lang/String;Z)Ljava/lang/Object;
    javax.servlet.ServletException: java.lang.NoSuchMethodError: com.opensymphony.xwork2.util.ValueStack.findValue(Ljava/lang/String;Z)Ljava/lang/Object;

    File: org/apache/struts2/components/Component.java
    Line number: 255

    ——————————————————————————–

    Stacktraces
    org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoSuchMethodError: com.opensymphony.xwork2.util.ValueStack.findValue(Ljava/lang/String;Z)Ljava/lang/Object;
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:

    2009-11-20 12:57 [回复]
  2. 沙发
    meng878399850:

    谢谢楼主分享!真的非常感谢!!!

    2011-09-08 16:51 [回复]

发表评论


QQ群互动

Linux系统与内核学习群:194051772

WP建站技术学习交流群:194062106

魔豆之路QR

魔豆的Linux内核之路

魔豆的Linux内核之路

优秀工程师当看优秀书籍

优秀程序员,要看优秀书!

赞助商广告

友荐云推荐