- 接(一)部分的......
- <strong>struts+hibernate增删改查</strong> (二)
- 操作Admin的页面。
- addAdmin.jsp
- <pre class="html" name="code"><%@ page contentType="text/html;charset=UTF-8"%>
- <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
- <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>JSP for AdminForm form</title>
- </head>
- <body>
- <html:form action="/addAdmin" method="post">
- <table>
- <tr><td>姓名:</td><td><html:text property="userName"/><html:errors property="userName"/></td></tr>
- <tr><td>密码:</td><td><html:password property="password"/><html:errors property="password"/></td></tr>
- <tr><td>年龄:</td><td><html:text property="age"/><html:errors property="age"/></td></tr>
- <tr><td>邮箱:</td><td><html:text property="mail"/><html:errors property="mail"/></td></tr>
- <tr><td><html:submit/></td><td><html:reset/></td></tr>
- </table>
- </html:form>
- </body>
- </html>
- </pre>
- allAdmin.jsp
- <pre class="html" name="code"><%@ page language="java" contentType="text/html;charset=UTF-8"%>
- <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
- <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
- <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
- <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
- <html:html lang="true">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <html:base />
- <title>allAdmin.jsp</title>
- </head>
- <body>
- <center>::ALL ADMIN::</center>
- <center>
- <table>
- <tr>
- <td>姓名</td>
- <td>年龄</td>
- <td>邮箱</td>
- <td>编辑</td>
- <td>删除</td>
- </tr>
- <logic:iterate id="admin" name="allAdmin" scope="request">
- <tr>
- <td><bean:write name="admin" property="username"/></td>
- <td><bean:write name="admin" property="age"/></td>
- <td><bean:write name="admin" property="mail"/></td>
- <td><a href="updateAdmin.jsp?key=<bean:write name='admin' property='id'/>"/>编辑</a></td>
- <td><a href="../deleteAdmin.do?key=<bean:write name='admin' property='id'/>"/>删除</a></td>
- </tr>
- </logic:iterate>
- </table>
- <br/>
- <a href="/admin/addAdmin.jsp">添加</a>
- <br/>
- <html:form action="/mainAdmin" method="post">
- <table>
- <tr>
- <td>
- Serach UserName:
- </td>
- <td>
- <html:text property="userName"></html:text>
- </td>
- </tr>
- <tr>
- <td>
- <html:button property="submit">submit</html:button>
- </td>
- <td>
- <html:reset>reset</html:reset>
- </td>
- </tr>
- </table>
- </html:form>
- </center>
- </body>
- </html:html></pre>
- <pre class="html" name="code"> </pre>
- <pre class="html" name="code">updateAdmin.jsp</pre>
- <pre class="html" name="code"><pre class="html" name="code"><%@ page language="java" pageEncoding="UTF-8"%>
- <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
- <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
- <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
- <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
- <html:html lang="true">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <html:base />
- <title>updateAdmin.jsp</title>
- </head>
- <body>
- <bean:parameter id="id" name="key"/>
- <html:form action="/updateAdmin" method="post">
- <table>
- <tr><td><html:hidden property="id" value="<%=id%>"></html:hidden>ID号:<%=id%></td></tr>
- <tr><td>姓名:</td><td><html:text property="userName"/><html:errors property="userName"/></td></tr>
- <tr><td>密码:</td><td><html:password property="password"/><html:errors property="password"/></td></tr>
- <tr><td>年龄:</td><td><html:text property="age"/><html:errors property="age"/></td></tr>
- <tr><td>邮箱:</td><td><html:text property="mail"/><html:errors property="mail"/></td></tr>
- <tr><td><html:submit/></td><td><html:reset/></td></tr>
- </table>
- </html:form>
- </body>
- </html:html></pre>
- <pre class="html" name="code"> </pre>
- <pre class="html" name="code">error.jsp</pre>
- <pre class="html" name="code"><pre class="html" name="code"><%@ page language="java" pageEncoding="UTF-8"%>
- <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
- <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
- <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
- <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html:html lang="true">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <html:base />
- <title>error.jsp</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">
- </head>
- <body>
- 操作失败!!! <br>
- </body>
- </html:html></pre>
- <pre class="html" name="code"> </pre>
- <pre class="html" name="code">success.jsp</pre>
- <pre class="html" name="code"><%@ page language="java" pageEncoding="UTF-8"%>
- <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
- <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
- <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
- <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html:html lang="true">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <html:base />
- <title>success.jsp</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">
- </head>
- <body>
- 操作成功!!! <br>
- <a href="/mainAdmin.do">返回</a>
- </body>
- </html:html>
- </pre>
- <pre class="html" name="code">message.jsp , struts中validate框架验证出错指向的页面</pre>
- <pre class="html" name="code"><pre class="html" name="code"><%@ page language="java" pageEncoding="UTF-8"%>
- <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
- <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
- <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
- <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html:html lang="true">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <html:base /></pre>
- <pre class="html" name="code"> <title>message.jsp</title></pre>
- <pre class="html" name="code"> <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">
- </head>
- <body>
- <table>
- <tr><html:errors/></tr>
- <tr><td>返回</td></tr>
- </table>
- </body>
- </html:html>
- </pre>
- </pre>
- <pre class="html" name="code">index.jsp</pre>
- <pre class="html" name="code"> </pre>
- <pre class="html" name="code"><pre class="html" name="code"><%@ page language="java" contentType="text/html;charset=UTF-8"%>
- <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
- <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
- <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
- <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
- <html:html lang="true">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>index.jsp</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <META HTTP-EQUIV="refresh" CONTENT="0;url=mainAdmin.do">
- </head>
- </html:html></pre>
- hibernate.reveng.xml</pre>
- </pre>
- <pre class="html" name="code"><pre class="xml" name="code"><?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
- <hibernate-reverse-engineering>
- <table name="ADMIN" class="com.hibernate.domain.Admin">
- <primary-key>
- <generator class="sequence"></generator>
- </primary-key>
- </table>
- </hibernate-reverse-engineering>
- </pre>
- </pre>
- <pre class="html" name="code">ApplicationResources.properties,struts资源文件</pre>
- <pre class="html" name="code"> </pre>
- <pre class="html" name="code"><pre class="java" name="code"># Resources for parameter 'com.Hs.struts.ApplicationResources'
- # Project P/HsTest
- errors.id=<li>id must need.</li>
- errors.userName=<li>userName must need.</li>
- errors.password=<li>password must need.</li>
- errors.age=<li>age must need.</li>
- errors.mail=<li>mail must need.</li>
- </pre>
- <pre class="java" name="code">终于快完了,爽啊,下面是主界面图</pre>
- <pre class="java" name="code"><img alt="" src="https://p-blog.csdn.net/images/p_blog_csdn_net/hxmcGu/allAdmin.JPG">
- </pre>
- </pre>
- </pre>
- over,就这么多了,时间有限不足之处请大家见谅^_^...