struts+hibernate增删改查(二)

[xml]  view plain copy
  1. 接(一)部分的......  
[xml]  view plain copy
  1. <strong>struts+hibernate增删改查</strong> (二)  
[xml]  view plain copy
  1. 操作Admin的页面。  
[xml]  view plain copy
  1. addAdmin.jsp  
[xml]  view plain copy
  1. <pre class="html" name="code"><%@ page contentType="text/html;charset=UTF-8"%>  
  2.   
  3. <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>   
  4.   
  5. <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>  
  6.   
  7. <html>   
  8.   
  9.     <head>  
  10.   
  11.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
  12.   
  13.         <title>JSP for AdminForm form</title>  
  14.   
  15.     </head>  
  16.   
  17.     <body>  
  18.   
  19.         <html:form action="/addAdmin" method="post">  
  20.   
  21.         <table>  
  22.   
  23.             <tr><td>姓名:</td><td><html:text property="userName"/><html:errors property="userName"/></td></tr>  
  24.   
  25.             <tr><td>密码:</td><td><html:password property="password"/><html:errors property="password"/></td></tr>  
  26.   
  27.             <tr><td>年龄:</td><td><html:text property="age"/><html:errors property="age"/></td></tr>  
  28.   
  29.             <tr><td>邮箱:</td><td><html:text property="mail"/><html:errors property="mail"/></td></tr>  
  30.   
  31.             <tr><td><html:submit/></td><td><html:reset/></td></tr>  
  32.   
  33.         </table>    
  34.   
  35.         </html:form>  
  36.   
  37.     </body>  
  38.   
  39. </html>  
  40. </pre>  
[xml]  view plain copy
  1. allAdmin.jsp  
[xml]  view plain copy
  1. <pre class="html" name="code"><%@ page language="java" contentType="text/html;charset=UTF-8"%>  
  2.   
  3. <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>  
  4.   
  5. <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>  
  6.   
  7. <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>  
  8.   
  9. <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>  
  10.   
  11. <html:html lang="true">  
  12.   
  13.   <head>  
  14.   
  15.   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
  16.   
  17.     <html:base />  
  18.   
  19.     <title>allAdmin.jsp</title>  
  20.   
  21.   </head>  
  22.   
  23.   <body>  
  24.   
  25.   <center>::ALL ADMIN::</center>  
  26.   
  27.   <center>  
  28.   
  29.     <table>  
  30.   
  31.     <tr>  
  32.   
  33.     <td>姓名</td>  
  34.   
  35.     <td>年龄</td>  
  36.   
  37.     <td>邮箱</td>  
  38.   
  39.     <td>编辑</td>  
  40.   
  41.     <td>删除</td>  
  42.   
  43.     </tr>   
  44.   
  45.     <logic:iterate id="admin" name="allAdmin" scope="request">  
  46.   
  47.     <tr>  
  48.   
  49.     <td><bean:write name="admin" property="username"/></td>  
  50.   
  51.     <td><bean:write name="admin" property="age"/></td>  
  52.   
  53.     <td><bean:write name="admin" property="mail"/></td>  
  54.   
  55.     <td><a href="updateAdmin.jsp?key=<bean:write name='admin' property='id'/>"/>编辑</a></td>  
  56.   
  57.     <td><a href="../deleteAdmin.do?key=<bean:write name='admin' property='id'/>"/>删除</a></td>  
  58.   
  59.     </tr>  
  60.   
  61.     </logic:iterate>  
  62.   
  63.     </table>  
  64.   
  65.     <br/>  
  66.   
  67.     <a href="/admin/addAdmin.jsp">添加</a>  
  68.   
  69.     <br/>  
  70.   
  71.     <html:form action="/mainAdmin" method="post">  
  72.   
  73.         <table>  
  74.   
  75.             <tr>  
  76.   
  77.                 <td>  
  78.   
  79.                     Serach UserName:      
  80.   
  81.                 </td>  
  82.   
  83.                 <td>  
  84.   
  85.                     <html:text property="userName"></html:text>  
  86.   
  87.                 </td>  
  88.   
  89.             </tr>  
  90.   
  91.             <tr>  
  92.   
  93.                 <td>  
  94.   
  95.                     <html:button property="submit">submit</html:button>  
  96.   
  97.                 </td>  
  98.   
  99.                 <td>  
  100.   
  101.                     <html:reset>reset</html:reset>  
  102.   
  103.                 </td>  
  104.   
  105.             </tr>   
  106.   
  107.         </table>  
  108.   
  109.     </html:form>  
  110.   
  111.   </center>  
  112.   
  113.   </body>  
  114.   
  115. </html:html></pre>  
  116. <pre class="html" name="code"> </pre>  
  117. <pre class="html" name="code">updateAdmin.jsp</pre>  
  118. <pre class="html" name="code"><pre class="html" name="code"><%@ page language="java" pageEncoding="UTF-8"%>  
  119.   
  120. <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>  
  121.   
  122. <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>  
  123.   
  124. <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>  
  125.   
  126. <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>  
  127.   
  128. <html:html lang="true">  
  129.   
  130.   <head>  
  131.   
  132.   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
  133.   
  134.     <html:base />    
  135.   
  136.     <title>updateAdmin.jsp</title>  
  137.   
  138.   </head>  
  139.   
  140.   <body>  
  141.   
  142.     <bean:parameter id="id" name="key"/>  
  143.   
  144.     <html:form action="/updateAdmin" method="post">  
  145.   
  146.      <table>  
  147.   
  148.         <tr><td><html:hidden property="id" value="<%=id%>"></html:hidden>ID号:<%=id%></td></tr>  
  149.   
  150.         <tr><td>姓名:</td><td><html:text property="userName"/><html:errors property="userName"/></td></tr>  
  151.   
  152.         <tr><td>密码:</td><td><html:password property="password"/><html:errors property="password"/></td></tr>  
  153.   
  154.         <tr><td>年龄:</td><td><html:text property="age"/><html:errors property="age"/></td></tr>  
  155.   
  156.         <tr><td>邮箱:</td><td><html:text property="mail"/><html:errors property="mail"/></td></tr>  
  157.   
  158.         <tr><td><html:submit/></td><td><html:reset/></td></tr>  
  159.   
  160.     </table>  
  161.   
  162.     </html:form>  
  163.   
  164.   </body>  
  165.   
  166. </html:html></pre>  
  167. <pre class="html" name="code"> </pre>  
  168. <pre class="html" name="code">error.jsp</pre>  
  169. <pre class="html" name="code"><pre class="html" name="code"><%@ page language="java" pageEncoding="UTF-8"%>  
  170.   
  171. <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>  
  172.   
  173. <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>  
  174.   
  175. <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>  
  176.   
  177. <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>  
  178.   
  179. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
  180.   
  181. <html:html lang="true">  
  182.   
  183.   <head>  
  184.   
  185.   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
  186.   
  187.     <html:base />  
  188.   
  189.     <title>error.jsp</title>  
  190.   
  191.     <meta http-equiv="pragma" content="no-cache">  
  192.   
  193.     <meta http-equiv="cache-control" content="no-cache">  
  194.   
  195.     <meta http-equiv="expires" content="0">      
  196.   
  197.     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">  
  198.   
  199.     <meta http-equiv="description" content="This is my page">  
  200.   
  201.   </head>  
  202.   
  203.   <body>  
  204.   
  205.    操作失败!!!  <br>  
  206.   
  207.   </body>  
  208.   
  209. </html:html></pre>  
  210. <pre class="html" name="code"> </pre>  
  211. <pre class="html" name="code">success.jsp</pre>  
  212. <pre class="html" name="code"><%@ page language="java" pageEncoding="UTF-8"%>  
  213.   
  214. <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>  
  215.   
  216. <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>  
  217.   
  218. <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>  
  219.   
  220. <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>  
  221.   
  222. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
  223.   
  224. <html:html lang="true">  
  225.   
  226.   <head>  
  227.   
  228.   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
  229.   
  230.     <html:base />  
  231.   
  232.     <title>success.jsp</title>   
  233.   
  234.     <meta http-equiv="pragma" content="no-cache">  
  235.   
  236.     <meta http-equiv="cache-control" content="no-cache">  
  237.   
  238.     <meta http-equiv="expires" content="0">      
  239.   
  240.     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">  
  241.   
  242.     <meta http-equiv="description" content="This is my page">  
  243.   
  244.   </head>  
  245.   
  246.   <body>  
  247.   
  248.    操作成功!!!  <br>  
  249.   
  250.    <a href="/mainAdmin.do">返回</a>  
  251.   
  252.   </body>  
  253.   
  254. </html:html>  
  255. </pre>  
  256. <pre class="html" name="code">message.jsp , struts中validate框架验证出错指向的页面</pre>  
  257. <pre class="html" name="code"><pre class="html" name="code"><%@ page language="java" pageEncoding="UTF-8"%>  
  258.   
  259. <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>  
  260.   
  261. <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>  
  262.   
  263. <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>  
  264.   
  265. <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>  
  266.   
  267. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
  268.   
  269. <html:html lang="true">  
  270.   
  271.   <head>  
  272.   
  273.   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
  274.   
  275.     <html:base /></pre>  
  276. <pre class="html" name="code">    <title>message.jsp</title></pre>  
  277. <pre class="html" name="code">    <meta http-equiv="pragma" content="no-cache">  
  278.   
  279.     <meta http-equiv="cache-control" content="no-cache">  
  280.   
  281.     <meta http-equiv="expires" content="0">      
  282.   
  283.     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">  
  284.   
  285.     <meta http-equiv="description" content="This is my page">  
  286.   
  287.   </head>  
  288.   
  289.   <body>  
  290.   
  291.     <table>  
  292.   
  293.     <tr><html:errors/></tr>  
  294.   
  295.     <tr><td>返回</td></tr>  
  296.   
  297.     </table>  
  298.   
  299.   </body>  
  300.   
  301. </html:html>  
  302. </pre>  
  303. </pre>  
  304. <pre class="html" name="code">index.jsp</pre>  
  305. <pre class="html" name="code"> </pre>  
  306. <pre class="html" name="code"><pre class="html" name="code"><%@ page language="java" contentType="text/html;charset=UTF-8"%>  
  307.   
  308. <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>  
  309.   
  310. <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>  
  311.   
  312. <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>  
  313.   
  314. <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>  
  315.   
  316. <html:html lang="true">  
  317.   
  318.   <head>  
  319.   
  320.   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
  321.   
  322.     <title>index.jsp</title>  
  323.   
  324.     <meta http-equiv="content-type" content="text/html; charset=UTF-8">  
  325.   
  326.     <META HTTP-EQUIV="refresh" CONTENT="0;url=mainAdmin.do">  
  327.   
  328.   </head>  
  329.   
  330. </html:html></pre>  
  331. hibernate.reveng.xml</pre>  
  332. </pre>  
  333. <pre class="html" name="code"><pre class="xml" name="code"><?xml version="1.0" encoding="UTF-8"?>  
  334.   
  335. <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >  
  336.   
  337. <hibernate-reverse-engineering>  
  338.   
  339. <table name="ADMIN" class="com.hibernate.domain.Admin">  
  340.   
  341.     <primary-key>  
  342.   
  343.         <generator class="sequence"></generator>  
  344.   
  345.     </primary-key>  
  346.   
  347. </table>  
  348.   
  349. </hibernate-reverse-engineering>  
  350. </pre>  
  351. </pre>  
  352. <pre class="html" name="code">ApplicationResources.properties,struts资源文件</pre>  
  353. <pre class="html" name="code"> </pre>  
  354. <pre class="html" name="code"><pre class="java" name="code"># Resources for parameter 'com.Hs.struts.ApplicationResources'  
  355.   
  356. # Project P/HsTest  
  357. errors.id=<li>id must need.</li>  
  358.   
  359. errors.userName=<li>userName must need.</li>  
  360.   
  361. errors.password=<li>password must need.</li>  
  362.   
  363. errors.age=<li>age must need.</li>  
  364.   
  365. errors.mail=<li>mail must need.</li>  
  366. </pre>  
  367. <pre class="java" name="code">终于快完了,爽啊,下面是主界面图</pre>  
  368. <pre class="java" name="code"><img alt="" src="https://p-blog.csdn.net/images/p_blog_csdn_net/hxmcGu/allAdmin.JPG">  
  369. </pre>  
  370. </pre>  
  371. </pre>  
  372. over,就这么多了,时间有限不足之处请大家见谅^_^...  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 该资源内项目源码是个人的课程设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值