coral 5 years ago
commit 2bf2f5fb6d

@ -1,7 +1,7 @@
#MyEclipse Hibernate Properties
#Fri Jan 03 19:00:56 CST 2020
#Sat Jan 04 15:25:24 CST 2020
sessionFactoryName=
genBasicCompId=true
genBasicCompId=false
profile=
daoSFId=
version=3.3
@ -11,7 +11,7 @@ reStrategyClass=
detectO2O=false
springDaoFile=
useJavaTypes=true
keyGenerator=native
keyGenerator=
libInstallFolder=WebRoot/WEB-INF/lib
addLibs2Project=true
genVersionTag=false

249
1.jsp

@ -1,249 +0,0 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
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">
-->
</head>
<body>
<script src="js/jquery-1.11.3.js"></script>
<style>
*{
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*早期浏览器*/
user-select: none;
}
#back{
background-image:url('./img/login2.png');
background-repeat: no-repeat,no-repeat;
background-size:contain,contain;
background-position: bottom;
height:93%;
width:100%;
}
.loginform{
position: relative;
width:350px;
margin-top: 8%;
margin-left: 15%
}
.loginform .logtype{
text-align: center;
margin-bottom: 30px;
letter-spacing: 1px;
}
.loginform .logtype a{
margin-right: 10px;
font-weight: bold;
font-size: 23px;
cursor: pointer;
}
.loginform .logtype a:ACTIVE{
color:#EEAD0E;
}
form{
}
form .info{
margin-bottom: 20px;
width:100%;
height:43px;
border-radius:7px;
background: rgb(235 ,235, 235);
border: none;
text-indent: 15px;
letter-spacing: 1px;
font-size: 95%;
outline-color: #FFB90F;
}
form .info:FOCUS{
background: white;
}
input::-moz-placeholder { /* Mozilla Firefox 4 to 18 适配火狐 */
color: rgb(180 ,180, 180);;
}
input::-webkit-input-placeholder { /* WebKit browsers 适配谷歌 */
color: rgb(180 ,180, 180);
}
.sub{
width:40%;
height:35px;
border-radius:7px;
border: none;
background: #FFB90F;
color: white;
font-size:120%;
letter-spacing: 4px;
display: inline;
vertical-align: top;
margin-top: 20px;
outline: none;
}
.sub:ACTIVE{
background: #EEAD0E;
}
.reg{
display: inline-block;
vertical-align: top;
margin-left: 40%;
text-align: right;
margin-top: 20px;
}
.reg p{
font-size: 80%;
color: rgb(180 ,180, 180);
margin-top: 0px;
margin-bottom: 5px;
cursor: pointer;
}
.reg p:ACTIVE {
color: #EEAD0E;
}
</style>
<style>/*导航*/
.newheader{
height: 60px;
background-color: #3CB371;
}
.head-nav{
height: 60px;
color: yellow;
position:relative;
left:-20px;
}
.head-nav #header-nav{
height: 60px;
color: yellow;
margin-top:0;
}
.logo{
}
.logo img{
height: 40px;
width: 40px;
float: left;
margin: auto 20px;
position:relative;
top:-10px;
}
.pr{
float: left;
margin: auto 10px;
}
.pr a{
color: white;
text-decoration: none;
position:relative;
top:20px;
}
.login{
height:60px;
}
</style>
<div class="newheader">
<div class="head-nav pr" id="head-navpre1">
<ul id="header-nav">
<a class="logo">
<img alt="" src="./img/sLogo.png" >
</a>
<li class="pr" style="display: block;">
<a href="/paths" >跳蚤市场</a>
</li>
<li class="pr" style="display: block;">
<a href="/courses" >校园超市</a>
</li>
<li class="pr" style="display: block;">
<a href="/shixuns">失物招领</a>
</li>
<li class="pr" style="display: block;">
<a href="/competitions">资源共享</a>
</li>
<li class="pr" style="display: block;">
<a href="/moop_cases">兴趣论坛</a>
</li>
</ul>
</div>
<span class="login pr" style="float: right;">
<a href="" class="mr5 color-white" >登录</a>
<em class="vertical-line" ></em>
<a href="/register" class="mr5 color-white">注册</a>
</span>
</div>
<div id="back" >
<div class="loginform">
<div class="logtype">
<a>登录</a>|
<a>注册</a>
</div>
<s:form action="Login" method="post" autocomplete="on">
<s:textfield name="user.username" cssClass="info" /><br/>
<s:password name="user.password" cssClass="info" placeholder="请输入密码" /><br/>
<input type="submit" class="sub" value="登录">
<div class="reg">
<p>注册</p>
<p>忘记密码</p>
</div>
</s:form>
<p style="text-align: center;font-family:cursive;">———其他登录方式 ———</p>
</div>
<div>
<script type="text/javascript">
var h=document.getElementById("back").clientHeight;
var w=document.getElementById("back").clientWidth;
if(h==null) console.log(0);
console.log(h);
console.log(w);
</script>
</body>
</html>

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.Qg" table="qg" catalog="postgres">
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="identity" />
</id>
<property name="title" type="java.lang.String">
<column name="title" length="45" />
</property>
<property name="miao" type="java.lang.String">
<column name="miao" length="45" />
</property>
<property name="price" type="java.lang.Integer">
<column name="price" />
</property>
<property name="wx" type="java.lang.String">
<column name="wx" length="45" />
</property>
<property name="tel" type="java.lang.String">
<column name="tel" length="45" />
</property>
<property name="qq" type="java.lang.String">
<column name="qq" length="45" />
</property>
</class>
</hibernate-mapping>

@ -11,13 +11,13 @@
<generator class="identity" />
</id>
<property name="title" type="java.lang.String">
<column name="title" length="45" not-null="true" />
<column name="title" length="45" />
</property>
<property name="desc" type="java.lang.String">
<column name="desc" length="45" />
<property name="miao" type="java.lang.String">
<column name="miao" length="45" />
</property>
<property name="sep" type="java.lang.Integer">
<column name="sep" not-null="true" />
<column name="sep" />
</property>
<property name="orp" type="java.lang.Integer">
<column name="orp" />

@ -24,6 +24,7 @@
<property name="connection.autocommit">true</property>
<mapping resource="com/Userinfo.hbm.xml" />
<mapping resource="com/Xz.hbm.xml" />
<mapping resource="com/Qg.hbm.xml" />
</session-factory>

@ -23,6 +23,10 @@
<result name="success">/welcome.jsp</result>
<result name="error">/success.jsp</result></action>
<action name="Fbqg" class="SubmitQgAction" method="submit">
<result name="success">/welcome.jsp</result>
<result name="error">/success.jsp</result></action>
</package>

@ -5,6 +5,22 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name></display-name>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
@ -16,5 +32,13 @@
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping></web-app>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
</web-app>

@ -0,0 +1,337 @@
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<button class="order"><span class="default">Complete Order</span><span class="success">Order Placed
<svg viewbox="0 0 12 10">
<polyline points="1.5 6 4.5 9 10.5 1"></polyline>
</svg></span>
<div class="box"></div>
<div class="drone">
<svg class="wing left">
<use xlink:href="#droneWing"></use>
</svg>
<svg class="wing right">
<use xlink:href="#droneWing"></use>
</svg>
<svg class="body">
<use xlink:href="#droneBody"></use>
</svg>
<svg class="grab">
<use xlink:href="#droneGrab"></use>
</svg>
</div>
</button>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 42 14" id="droneBody" fill="currentColor" stroke="none">
<path d="M38,0.5 C38,0.223857625 38.2238576,5.07265313e-17 38.5,0 C38.7761424,-5.07265313e-17 39,0.223857625 39,0.5 L39,4 C39.5522847,4 40,4.44771525 40,5 L40,6 L40.5,6 C41.3284271,6 42,6.67157288 42,7.5 C42,8.32842712 41.3284271,9 40.5,9 L30,9 L30,9.86761924 C30,10.5701449 29.6314023,11.2211586 29.0289915,11.5826051 L25.4750236,13.7149859 C25.1641928,13.9014843 24.80852,14 24.4460321,14 L17.5539679,14 C17.19148,14 16.8358072,13.9014843 16.5249764,13.7149859 L12.9710085,11.5826051 C12.3685977,11.2211586 12,10.5701449 12,9.86761924 L12,9 L1.5,9 C0.671572875,9 1.01453063e-16,8.32842712 0,7.5 C-1.01453063e-16,6.67157288 0.671572875,6 1.5,6 L2,6 L2,5 C2,4.44771525 2.44771525,4 3,4 L3,0.5 C3,0.223857625 3.22385763,5.07265313e-17 3.5,0 C3.77614237,-5.07265313e-17 4,0.223857625 4,0.5 L4,4 C4.55228475,4 5,4.44771525 5,5 L5,6 L12.005,6 L12.0064818,5.97128221 C12.0580908,5.33141252 12.414937,4.75103782 12.9710085,4.41739491 L16.5249764,2.28501415 C16.8358072,2.09851567 17.19148,2 17.5539679,2 L24.4460321,2 C24.80852,2 25.1641928,2.09851567 25.4750236,2.28501415 L29.0289915,4.41739491 C29.5934099,4.75604592 29.952577,5.34889137 29.9956355,6.0001358 L37,6 L37,5 C37,4.44771525 37.4477153,4 38,4 L38,0.5 Z"></path>
</symbol>
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 14" id="droneGrab" fill="none" stroke="currentColor">
<path d="M5,13 L1,13 C1,7.66666667 3.33333333,3.66666667 8,1 L17.996238,1 C22.6654127,3 25,7 25,13 L21.0005587,13" stroke-width="2" stroke-linecap="round"></path>
</symbol>
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21 2" id="droneWing" fill="currentColor" stroke="none">
<path d="M13,2 C12.4477153,2 12,1.55228475 12,1 C12,0.44771525 12.4477153,0 13,0 C13.5522847,0 21,0.44771525 21,1 C21,1.55228475 13.5522847,2 13,2 Z"></path>
<path d="M8,2 C7.44771525,2 0,1.55228475 0,1 C0,0.44771525 7.44771525,0 8,0 C8.55228475,0 9,0.44771525 9,1 C9,1.55228475 8.55228475,2 8,2 Z"></path>
</symbol>
</svg>
<style>
:root {
--primary: #275EFE;
--primary-dark: #2850C4;
--primary-light: #668DFF;
--dark: #1C212E;
--white: #FFF;
--green: #16BF78;
--sand: #DCB773;
}
.order {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 0;
background: var(--white);
position: relative;
height: 63px;
width: 240px;
padding: 0;
cursor: pointer;
border-radius: 32px;
overflow: hidden;
-webkit-mask-image: -webkit-radial-gradient(white, black);
transition: -webkit-transform .3s ease;
transition: transform .3s ease;
transition: transform .3s ease, -webkit-transform .3s ease;
}
.order span {
--y: 0;
position: absolute;
left: 0;
right: 0;
text-align: center;
top: 19px;
line-height: 24px;
color: var(--dark);
font-size: 16px;
font-weight: 500;
-webkit-transform: translateY(var(--y));
transform: translateY(var(--y));
}
.order span.default {
transition-delay: .3s;
transition: opacity .3s ease .3s;
}
.order span.success {
--y: 60px;
transition: -webkit-transform .5s ease;
transition: transform .5s ease;
transition: transform .5s ease, -webkit-transform .5s ease;
}
.order span.success svg {
width: 12px;
height: 10px;
display: inline-block;
vertical-align: top;
fill: none;
margin: 7px 0 0 4px;
stroke: var(--green);
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 16px;
stroke-dashoffset: 16px;
transition: stroke-dashoffset .3s ease;
}
.order:active {
-webkit-transform: scale(0.94);
transform: scale(0.94);
}
.order .box,
.order .drone {
position: absolute;
}
.order .box {
width: 20px;
height: 20px;
left: 50%;
margin-left: -10px;
top: 100%;
border-radius: 2px;
background: var(--sand);
}
.order .box:before, .order .box:after {
content: '';
position: absolute;
display: block;
left: 5px;
}
.order .box:before {
top: 0;
width: 4px;
height: 9px;
background: rgba(255, 255, 255, 0.3);
}
.order .box:after {
z-index: 1;
top: 7px;
width: 0;
height: 0;
border-style: solid;
border-width: 0 2px 2px 2px;
border-color: transparent transparent var(--sand) transparent;
}
.order .drone {
width: 42px;
height: 14px;
z-index: 1;
top: 16px;
right: 100%;
-webkit-transform: translateX(-7px);
transform: translateX(-7px);
}
.order .drone svg {
display: block;
}
.order .drone svg.body {
width: 42px;
height: 14px;
position: relative;
z-index: 1;
color: var(--primary);
}
.order .drone svg.wing {
position: absolute;
width: 21px;
height: 2px;
top: 1px;
color: var(--primary-light);
}
.order .drone svg.wing.left {
left: -7px;
}
.order .drone svg.wing.right {
right: -7px;
}
.order .drone svg.grab {
position: absolute;
width: 26px;
height: 14px;
left: 8px;
top: 10px;
color: var(--primary-dark);
stroke-dashoffset: 34px;
stroke-dasharray: 0 48px 19px 48px;
}
.order.animate .default {
opacity: 0;
transition-delay: 0s;
}
.order.animate .success {
--y: 0;
transition-delay: 3.85s;
}
.order.animate .success svg {
transition-delay: 4.3s;
stroke-dashoffset: 0;
}
.order.animate .drone {
-webkit-animation: move 5s ease forwards;
animation: move 5s ease forwards;
}
.order.animate .drone .wing {
-webkit-animation: wing 5s linear forwards;
animation: wing 5s linear forwards;
}
.order.animate .drone .grab {
-webkit-animation: grab .6s ease forwards 2.3s;
animation: grab .6s ease forwards 2.3s;
}
.order.animate .box {
-webkit-animation: box 5s ease forwards;
animation: box 5s ease forwards;
}
@-webkit-keyframes move {
0% {
-webkit-transform: translateX(-7px) rotate(14deg);
transform: translateX(-7px) rotate(14deg);
}
55%,
70% {
-webkit-transform: translateX(141px) rotate(0deg);
transform: translateX(141px) rotate(0deg);
}
100% {
-webkit-transform: translateX(141px) translateY(-84px) rotate(0deg);
transform: translateX(141px) translateY(-84px) rotate(0deg);
}
}
@keyframes move {
0% {
-webkit-transform: translateX(-7px) rotate(14deg);
transform: translateX(-7px) rotate(14deg);
}
55%,
70% {
-webkit-transform: translateX(141px) rotate(0deg);
transform: translateX(141px) rotate(0deg);
}
100% {
-webkit-transform: translateX(141px) translateY(-84px) rotate(0deg);
transform: translateX(141px) translateY(-84px) rotate(0deg);
}
}
@-webkit-keyframes grab {
100% {
stroke-dashoffset: 48px;
stroke-dasharray: 0 48px 48px 48px;
}
}
@keyframes grab {
100% {
stroke-dashoffset: 48px;
stroke-dasharray: 0 48px 48px 48px;
}
}
@-webkit-keyframes wing {
100% {
-webkit-transform: rotateY(7200deg);
transform: rotateY(7200deg);
}
}
@keyframes wing {
100% {
-webkit-transform: rotateY(7200deg);
transform: rotateY(7200deg);
}
}
@-webkit-keyframes box {
0%,
10% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
55%,
70% {
-webkit-transform: translateY(-28px);
transform: translateY(-28px);
}
100% {
-webkit-transform: translateY(-112px);
transform: translateY(-112px);
}
}
@keyframes box {
0%,
10% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
55%,
70% {
-webkit-transform: translateY(-28px);
transform: translateY(-28px);
}
100% {
-webkit-transform: translateY(-112px);
transform: translateY(-112px);
}
}
html {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}
* {
box-sizing: inherit;
}
*:before, *:after {
box-sizing: inherit;
}
body {
min-height: 100vh;
font-family: Roboto, Arial;
display: flex;
justify-content: center;
align-items: center;
background: #121621;
}
</style>
<script>
$('.order').click(function(e) {
let button = $(this);
if(!button.hasClass('animate')) {
button.addClass('animate');
setTimeout(() => {
button.removeClass('animate');
}, 6500);
}
});
</script>

@ -0,0 +1,626 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
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>My JSP 'buy.jsp' starting page</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">
-->
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
<style>
*::selection{
background: none;
}
*{
margin: 0;
padding: 0;
}
body{
width:1520px;
position:relative;
background: #F5F5F5;
}
.back{
width:1520px;
z-index: -1;
position: absolute;
}
.newheader{
height: 60px;
background-color: #00CD66;
width:1520px;
position: fixed;
z-index: 110;
top:0;
}
.head-nav{
height: 60px;
color: yellow;
position:relative;
left:-20px;
}
.head-nav #header-nav{
height: 60px;
color: yellow;
margin-top:0;
}
.logo{
}
.logo img{
height: 60px;
width: 60px;
float: left;
margin: auto 20px;
position:relative;
top:-15px;
}
.pr{
float: left;
margin: auto 10px;
}
.pr a{
color: white;
text-decoration: none;
position:relative;
top:20px;
}
.login{
height:60px;
}
.color-white{
margin: 10px 10px 10px 10px;
}
.mr5{
position:relative;
bottom: -20px;
}
body{
background-repeat: no-repeat;
background-size:cover;
background-position: 0 60px;
height:100%;
}
</style>
<img class="back" alt="" src="./img/tzsc.png">
<div class="newheader">
<div class="head-nav pr" id="head-navpre1">
<ul id="header-nav">
<a class="logo">
<img alt="" src="./img/sLogo.png" >
</a>
<li class="pr" style="display: block;">
<a href="/paths" >跳蚤市场</a>
</li>
<li class="pr" style="display: block;">
<a href="/courses" >校园超市</a>
</li>
<li class="pr" style="display: block;">
<a href="/shixuns">失物招领</a>
</li>
<li class="pr" style="display: block;">
<a href="/competitions">资源共享</a>
</li>
<li class="pr" style="display: block;">
<a href="/moop_cases">兴趣论坛</a>
</li>
</ul>
</div>
<span class="login pr" style="float: right;">
<a href="./Login/login.jsp" class="mr5 color-white" >登录</a>
<em class="vertical-line" ></em>
<a href="/register" class="mr5 color-white">注册</a>
</span>
</div>
<!-- 以上导航 -->
<!-- 以下两大类别 -->
<style>
*{
padding: 0;
margin: 0;
}
.twobord{
position:absolute;
height: 100px;
top:600px;
width:1520px;
}
.twotypes{
position:absolute;
width:1000px;
height: 100px;
left:260px;
text-align: center;
}
.chose{
height:100px;
float:left;
display: inline-block;
position: absolute;
}
.chose1{
width:400px;
z-index:11;
left:50px;
cursor: pointer;
}
.chose2{
width:370px;
right: 50px;
position: absolute;
z-index: 11;
cursor: pointer;
}
.chose div{
position:absolute;
width: 300px;
height:100px;
display: inline-block;
float: left;
left:100px;
background: rgba(5,5,5,0);
}
.chose img{
position:absolute;
width:100px;
display: inline-block;
left:0px;
float: left;
top:0px;
height:100px;
}
.chose p{
text-align: left;
text-indent: 10px;
z-index: 10;
}
.chose div p:FIRST-CHILD {
margin-top: 10px;
font-size: 30px;
} .chose div p:LAST-CHILD{
}
</style>
<div class="twobord">
<div class="twotypes">
<div class=" chose chose1" onclick="tiao()">
<img alt="" src="./img/look.png" >
<div>
<p > 查看求购</p>
<p >逛市场可以赚大钱哦~</p>
</div>
</div>
<div class="chose chose2" onclick="tiao()">
<img alt="" src="./img/fabu.png">
<div>
<p>发布闲置</p>
<p>逛市场可以赚大钱哦~</p>
</div>
</div>
</div>
<script type="text/javascript">
function tiao(){
window.location.href='http://www.baidu.com';
}
</script>
<!-- 以下类别导航 -->
<style>
.bord-nav{
border-radius:7px;
position: relative;
top:150px;
height:60px;
width:1070px;
margin: 0 auto;
background: white;
}
#buy-nav{
position:relative;
padding:10px auto;
height:60px;
width:1070px;
}
.type{
float: left;
margin-left: 100px;
position: relative;
top:35%;
}
.type a{
font-size: 20px;
text-decoration: none;
}
</style>
<div style="position: relative;">
<div class="bord-nav">
<ul id="buy-nav">
<li class="type" style="display: block;">
<a href="" >书籍</a>
</li>
<li class="type" style="display: block;">
<a href="" >美妆</a>
</li>
<li class="type" style="display: block;">
<a href="">宠物粮</a>
</li>
<li class="type" style="display: block;">
<a href="">笔记</a>
</li>
<li class="type" style="display: block;">
<a href="">手机</a>
</li>
<li class="type" style="display: block;">
<a href="">手机</a>
</li>
<li class="type" style="display: block;">
<a href="">手机</a>
</li>
</ul>
</div>
</div>
<!-- 商品显示 -->
<style>
.homepage_introduce{
top:320px;
position: relative;
width:1100px;
height:auto;
margin: 0 auto;
padding: 0 0;
top:160px;
}
.active{
width: 207px;
height: 300px;
position: relative;
left:-20px;
display: inline-block;
vertical-align: top;
background:white;
background-size:contain;
background-repeat:no-repeat;
z-index:2;
border-radius:5px;
margin-left: 0px;
margin-right: 10px;
margin-bottom: 10px;
}
.active:HOVER{
height: 300px;
margin-top: -5px;
}
.homepage_introduce ul{
list-style-type:none;
padding-top: 0;
position:relative;
display: inline-block;
height:auto;
width:1150px;
margin-bottom: 10px;
left:30px;
}
.colorWhite{
text-decoration: none;
}
</style>
<!-- <li class="active" >
<div id="hover2" style="height:100% ;">
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
<li class="active" >
<div id="hover3" style="height:100% ;">
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
<li class="active" >
<div id="hover4" style="height:100% ;">
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
<li class="active" >
<div id="hover" style="height:100% ;">
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
<!-- </ul>
<ul >
<li class="active one" >
<div id="hover1" style="height:100% ;">
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
<li class="active" >
<div id="hover2" style="height:100% ;">
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
<li class="active" >
<div id="hover3" style="height:100% ;">
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
<li class="active" >
<div id="hover4" style="height:100% ;">
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
<li class="active" >
<div id="hover" style="height:100% ;">
<p class="f18 floatingName"><a href="http://ossean.trustie.net/" class="colorWhite">OSSEAN</a></p>
<p class="f16 mb20">资源共享平台</p>
<p class="f12 mb30 break_full_word floatingContent">高效汇聚全球开源开放的软件工程大数据,持续分析与评估开源生态发展态势</p>
</div>
</li>
-->
<!--
<div class="homepage_introduce" >
<ul class="exam">
<li class="active one" v-for="item in items" >
<div id="hover1" style="height:100% ;">
{{item}}
</div>
</li>
</ul>
</div>
-->
<div class="homepage_introduce" >
<ul class="exam">
<%! int id[]={0,1,2,3,4,5,6,7,8,9}; %>
<%
for(int i=0;i<id.length;i++ ){
%>
<li class="active one" onclick="act(<%=id[i]%>)">
<div id="hover1" style="height:100% ;">
<%=id[i]%>
</div>
</li>
<%
}
%>
</ul>
</div>
<script type="text/javascript">
function act(id){
console.log(id);
//这个就是跳转,在后面加参数
window.location.href='./HelloServlet?id='+id;
}
var exam = new Vue({
el: '.exam',
data: {
items:0
},
/*methods:{
nextp:function(){
console.log(000);
while(i=9)
i--;
this.items[i]=this.items[i]+10;
console.log(i);
}
}*/
})
</script>
<!-- 分页 -->
<style type="text/css">
.pagination{
position:relative;
text-align: center;
top:150px;
margin-bottom: 20px;
z-index: 2;
}
.pagination ul li{
position: relative;
display: inline-block;
border-radius:50%;
width:25px;
height:25px;
background: white;
cursor: pointer;
}
.pagination ul li a{
text-decoration: none;
color: black;
}
#firstpage{
background: #00CD66;
}
#a{
color: white;
}
</style>
<div>
<div class="pagination">
<ul class="on">
<li class="prev"><a><</a></li>
<li class="li" id="firstpage"><a id="a">1</a></li>
<li class="li"><a>2</a></li>
<li class="li"><a>3</a></li>
<li class="li"><a>4</a></li>
<li class="next" ><a>></a></li>
</ul>
</div>
</div>
<script type="text/javascript">
$(".pagination .li").click(function(){
var a = $(this).html();
console.log(a);
$("#firstpage").removeAttr("id");
$("#a").removeAttr("id");
$(this).attr('id','firstpage');
$("#firstpage a").attr('id','a');
})
$(".pagination .prev").click(function(){
if($("#firstpage").children().html()!='1')
{
var pre = $("#firstpage").prev();
var prea = $("#firstpage").prev().children();
$("#firstpage").removeAttr("id");
$("#a").removeAttr("id");
pre.attr('id','firstpage');
prea.attr('id','a');
}
})
$(".pagination .next").click(function(){
if($("#firstpage").children().html()!='4')
{
var pre = $("#firstpage").next();
var prea = $("#firstpage").next().children();
$("#firstpage").removeAttr("id");
$("#a").removeAttr("id");
pre.attr('id','firstpage');
prea.attr('id','a');
}
})
</script>
</body>
</html>

@ -1,4 +1,6 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
@ -95,7 +97,7 @@ width:800px;
</div>
<div class="bord">
<div class="container">
<form class="contact" action="#" method="post" id="form" enctype="multipart/form-data" onsubmit="" name="form">
<s:form class="contact" action="Fbqg" method="post" id="form" enctype="multipart/form-data" onsubmit="" name="form">
@ -104,8 +106,8 @@ width:800px;
<label for="name">
标题</label>
</div>
<div class="ctrl">
<input type="text" id="name" name="lxr" data-required="true" data-validation="text" data-msg="Invalid Name" placeholder="很重要,显示在列表页">
<div class="ctrl">
<s:textfield name="qg.title" data-required="true" data-validation="text" data-msg="Invalid Name" placeholder="很重要,显示在列表页" />
</div>
</div>
@ -115,9 +117,8 @@ width:800px;
简介</label>
</div>
<div class="ctrl">
<textarea class="in" id="message" name="body" rows="6" cols="10" placeholder="让大家更清楚地了解你的需求吧~"></textarea>
</div>
<s:textfield name="qg.miao" cssClass="in" rows="6" cols="10" placeholder="让大家更清楚地了解你的需求吧~" />
</div>
</div>
<div class="row clearfix">
@ -126,8 +127,8 @@ width:800px;
可接受价格</label>
</div>
<div class="ctrl">
<input type="text" calss="in" id="phone" name="wx" data-required="true" data-validation="custom" data-msg="Invalid Phone #" placeholder="想多少钱入手呢?">
</div>
<s:textarea cssClass="in" name="qg.price" data-required="true" data-validation="custom" data-msg="Invalid Phone #" placeholder="想多少钱入手呢?"/>
</div>
</div>
@ -137,8 +138,8 @@ width:800px;
微信号</label>
</div>
<div class="ctrl">
<input type="text"class="in" id="phone" name="choujin" data-required="true" data-validation="custom" data-msg="Invalid Phone #" placeholder="微信号手机号QQ号要至少填一项的">
</div>
<s:textarea cssClass="in" id="phone" name="qg.wx" data-required="true" data-validation="custom" data-msg="Invalid Phone #" placeholder="微信号手机号QQ号要至少填一项的"/>
</div>
</div>
<div class="row clearfix">
@ -147,8 +148,8 @@ width:800px;
手机号</label>
</div>
<div class="ctrl">
<input type="text"class="in" id="phone" name="choujin" data-required="true" data-validation="custom" data-msg="Invalid Phone #" placeholder="微信号手机号QQ号要至少填一项的 ">
</div>
<s:textarea cssClass="in" id="phone" name="qg.tel" data-required="true" data-validation="custom" data-msg="Invalid Phone #" placeholder="微信号手机号QQ号要至少填一项的 "/>
</div>
</div>
<div class="row clearfix">
@ -157,7 +158,7 @@ width:800px;
QQ号</label>
</div>
<div class="ctrl">
<input type="text"class="in" id="phone" name="choujin" data-required="true" data-validation="custom" data-msg="Invalid Phone #" placeholder="微信号手机号QQ号要至少填一项的 ">
<s:textarea cssClass="in" id="phone" name="qg.qq" data-required="true" data-validation="custom" data-msg="Invalid Phone #" placeholder="微信号手机号QQ号要至少填一项的 "/>
</div>
</div>
@ -207,22 +208,14 @@ function compress() {
}
</script>
</div>
</div>
<input type="hidden" value="1577948535" name="senddate">
<input type="hidden" value="1577948535" name="sortrank">
<input type="hidden" value="1577948535" name="arcrank">
<input type="hidden" value="1" name="typeid">
<input type="hidden" value="20" name="channelid">
<input type="hidden" value="1" name="type">
<div class="row clearfix">
<div class="span10 offset2">
<input type="submit" name="submit" class="submit" value="确认发布">
</div>
</div>
<div style="clear: both"></div>
</form>
</s:form>
<div style="clear: both"></div>
</div>
</div>

@ -96,8 +96,8 @@ width:800px;
<a>————</a><a style="margin: 0 40px;">发布闲置</a><a>————</a>
</div>
<div class="bord">
<div class="container">
<s:form class="contact" action="Fbxz" method="post" id="form" enctype="multipart/form-data" onsubmit="" name="form">
<div class="container" >
<s:form class="contact" action="Fbxz" method="post" id="form_example" enctype="multipart/form-data" onsubmit="" name="form">
@ -109,7 +109,7 @@ width:800px;
标题</label>
</div>
<div class="ctrl">
<s:textfield name="xz.title" data-required="true" data-validation="text" data-msg="Invalid Name" placeholder="很重要,显示在列表页" />
<s:textfield name="xz.title" data-required="true" data-validation="text" data-msg="Invalid Name" placeholder="很重要,显示在列表页" />
</div>
</div>
@ -120,7 +120,7 @@ width:800px;
</div>
<div class="ctrl">
<s:textfield name="xz.desc" cssClass="in" rows="6" cols="10" placeholder="描述一下你曾经的宝贝吧~" />
<s:textfield name="xz.miao" cssClass="in" rows="6" cols="10" placeholder="描述一下你曾经的宝贝吧~" />
</div>
</div>
@ -184,17 +184,163 @@ width:800px;
</div>
</div>
<!--
<div class="row clearfix"><div class="lbl">
<label>上传图片:</label></div>
<div class="ctrl">
<div style="display: none" id="myss"> <img id="img" src="">
<div style="height: 20px"></div>
</div>
<input id="file" type="file" onchange="compress()" name="file" style="height:25px;border:none">
<input id="files" multiple type="file" onchange="compress()" name="file" style="height:25px;border:none">
<input type="hidden" value="" name="image" id="image">
<script type="text/javascript">
$(document).ready(function () {
var fileList = [];
var fileCatcher = document.getElementById('form_example');
var files = document.getElementById("files"), renderFileList;
var fileListDisplay = document.getElementById('file-list-display')/*, sendFile*/;
fileCatcher.addEventListener("submit", function (event) {
//event.preventDefault();
//上传文件
//sendFile();
console.log(1);
});
files.addEventListener("change", function (event) {
for (var i = 0; i < files.files.length; i++) {
console.log("file"+i);
fileList.push(files.files[i]);
}
console.log(2);
renderFileList();
console.log(3);
});
renderFileList = function () {
fileListDisplay.innerHTML = '';
fileList.forEach(function (file, index) {
{}
let fileObj = file ;//上传文件的对象
let reader = new FileReader();
reader.readAsDataURL(fileObj);
reader.onload = function(e) {
let image = new Image() ;//新建一个img标签还没嵌入DOM节点)
image.src = e.target.result;
image.onload = function() {
let canvas = document.createElement('canvas'),
context = canvas.getContext('2d'),
may=300/image.width,
imageWidth =300, //压缩后图片的大小
imageHeight = image.height*may,
data = '';
canvas.width = imageWidth;
canvas.height = imageHeight;
context.drawImage(image, 0, 0, imageWidth, imageHeight);
data = canvas.toDataURL('image/jpeg');
console.log("data");
var imgg = document.createElement("img");
imgg.src =data ;
fileListDisplay.appendChild(imgg);
}};
console.log(4);
var fileDisplayEl = document.createElement("p");
fileDisplayEl.innerHTML = (index + 1) + ":" + file.name;
fileListDisplay.appendChild(fileDisplayEl);
})
};
/*
sendFile = function () {
console.log(5);
var formData = new FormData();
var request = new XMLHttpRequest();
//循环添加到formData中
fileList.forEach(function (file) {
console.log(6);
formData.append('files', file, file.name);
})
request.open("POST", "/test/upload.do");
request.send(formData);
}
*/
})
</script>
<!--
<script>
// 对图片进行压缩
function compress() {
let fileObj = document.getElementById('file').files[0] ;//上传文件的对象
let reader = new FileReader();
reader.readAsDataURL(fileObj);
reader.onload = function(e) {
let image = new Image() ;//新建一个img标签还没嵌入DOM节点)
image.src = e.target.result;
image.onload = function() {
let canvas = document.createElement('canvas'),
context = canvas.getContext('2d'),
may=300/image.width,
imageWidth =300, //压缩后图片的大小
imageHeight = image.height*may,
data = '';
canvas.width = imageWidth;
canvas.height = imageHeight;
context.drawImage(image, 0, 0, imageWidth, imageHeight);
data = canvas.toDataURL('image/jpeg');
console.log(data);
//压缩完成
document.getElementById('img').src = data;
//document.getElementById('image').value =data;
var div = document.getElementById("myss");
div.style.setProperty('display','block');
}
}
}
</script>
<!-- <script>
// 对图片进行压缩
function compress() {
let fileObj = document.getElementById('file').files[0] ;//上传文件的对象
@ -246,8 +392,9 @@ function compress() {
<s:submit cssClass="submit" value="确认发布" />
</div>
</div>
<div style="clear: both"></div>
<div style="clear: both"></div>
</s:form>
<div id='file-list-display'></div>
<div style="clear: both"></div>
</div>
</div>

@ -0,0 +1,15 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head><title>添加学生信息</title></head>
<body>
<table>
<tr><td>ID</td><td>title</td></tr>
<c:forEach var="s" items="${xz }">
<tr>
<td>${s.id }</td>
<td>${s.title }</td>
</tr>
</c:forEach>
</table></body></html>

@ -1,18 +0,0 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello World From Struts2</h1>
<form action="hello">
<label for="name">Please enter your name</label><br/>
<input type="text" name="name"/>
<input type="submit" value="Say Hello"/>
</form>
</body>
</html>

@ -1,16 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head><title>登录页面</title></head>
<body>
<p>请输入用户名和密码</p>
<s:form action="Login">
<s:textfield name="user.username" label="用户名"
tooltip="输入用户名" labelposition="left" />
<s:password name="user.password" label="密码"
tooltip="输入密码" labelposition="left" />
<s:submit value="登录" align="center" />
</s:form>
</body></html>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.hibernate.MYECLIPSE_HIBERNATE3_3_CORE"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mysql-connector-java-5.1.47.jar"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>

@ -0,0 +1,25 @@
#MyEclipse Hibernate Properties
#Sat Jan 04 23:52:24 CST 2020
sessionFactoryName=hib.HibernateSessionFactory
genBasicCompId=false
profile=
daoSFId=
version=3.3
jndiPath=
detectM2M=false
reStrategyClass=
detectO2O=false
springDaoFile=
useJavaTypes=true
keyGenerator=
libInstallFolder=WebRoot/WEB-INF/lib
addLibs2Project=true
genVersionTag=false
sessionFactoryId=
basePersistenceClass=
genAnnotations=false
reSettingsFile=
configFile=/pagebean/src/hibernate.cfg.xml
createConfigFile=true
addLibs2Classpath=true
baseDaoClass=BaseHibernateDAO

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-module
type="WEB"
name="pagebean"
id="myeclipse.1578151183785"
context-root="/pagebean"
j2ee-spec="5.0"
archive="pagebean.war">
<attributes>
<attribute name="webrootdir" value="WebRoot" />
</attributes>
</project-module>

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>pagebean</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.hibernate.HibernateBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
<nature>com.genuitec.eclipse.hibernate.hibernatenature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
</natures>
</projectDescription>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebRoot"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

@ -0,0 +1,12 @@
#Sat Jan 04 23:57:23 CST 2020
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="pagebean">
<wb-resource deploy-path="/" source-path="/WebRoot"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<property name="context-root" value="/pagebean"/>
<property name="java-output-path" value="/pagebean/WebRoot/WEB-INF/classes"/>
</wb-module>
</project-modules>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.5"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="hib.Products" table="products" catalog="myday">
<composite-id name="id" class="hib.ProductsId">
<key-property name="proId" type="java.lang.Integer">
<column name="proId" />
</key-property>
<key-property name="userId" type="java.lang.Integer">
<column name="userId" />
</key-property>
<key-property name="proName" type="java.lang.String">
<column name="proName" />
</key-property>
<key-property name="contact" type="java.lang.String">
<column name="contact" />
</key-property>
<key-property name="price" type="java.lang.Float">
<column name="price" precision="12" scale="0" />
</key-property>
<key-property name="oprice" type="java.lang.Float">
<column name="oprice" precision="12" scale="0" />
</key-property>
<key-property name="type" type="java.lang.Integer">
<column name="type" />
</key-property>
<key-property name="classifyId" type="java.lang.Integer">
<column name="classifyId" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>

@ -0,0 +1,26 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/myday
</property>
<property name="connection.username">root</property>
<property name="connection.password">mysql123</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="myeclipse.connection.profile">myday</property>
<mapping resource="hib/Products.hbm.xml" />
</session-factory>
</hibernate-configuration>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

@ -0,0 +1,26 @@
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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>My JSP 'index.jsp' starting page</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">
-->
</head>
<body>
This is my JSP page. <br>
</body>
</html>

@ -0,0 +1,42 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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>Insert title here</title>
</head>
<body>
<%-- 构建分页导航 --%>
共有${requestScope.pageBean.totalRecord}条信息,共${requestScope.pageBean.totalPage }页,当前为${requestScope.pageBean.pageNum}页
<br/>
<c:choose>
<c:when test="${requestScope.pageBean.pageNum != 1 }"><!-- 如果当前页为1则不显示首页和上一页 -->
<a href="${pageContext.request.contextPath}/FindAllWithPage?pageNum=1">首页</a>
<a href="${pageContext.request.contextPath}/FindAllWithPage?pageNum=${requestScope.pageBean.pageNum-1 }">上一页</a>
</c:when>
</c:choose>
<!-- 遍历页码 -->
<c:forEach begin="${requestScope.pageBean.start}" end="${requestScope.pageBean.end}" step="1" var="i">
<c:choose>
<c:when test="${requestScope.pageBean.pageNum == i}"><!-- 如果为当前页,则特殊显示 -->
<a style="height:24px; margin:0 3px; border:none;">${i}</a>
</c:when>
<c:otherwise><!-- 否则,普通显示 -->
<a href="?pageNum=${i}">${i}</a>
</c:otherwise>
</c:choose>
</c:forEach>
<c:choose>
<c:when test="${requestScope.pageBean.pageNum != requestScope.pageBean.totalPage }"><!-- 如果当前页为总的记录数,则不显示末页和下一页 -->
<a href="${pageContext.request.contextPath}/FindAllWithPage?pageNum=${requestScope.pageBean.pageNum+1 }">下一页</a>
<a href="${pageContext.request.contextPath}/FindAllWithPage?pageNum=${requestScope.pageBean.totalPage }">末页</a>
</c:when>
</c:choose>
<%--尾页 --%>
<a href="${pageContext.request.contextPath}/FindAllWithPage?pageNum=${requestScope.pageBean.totalPage}">尾页</a>
</body>
</html>

@ -0,0 +1,31 @@
package action;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.PageBean;
import service.ProductService;
public class ProductAction {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int pageNum = Integer.valueOf(request.getParameter("pageNum"));
int pageSize=10;
ProductService ps = new ProductService();
//获取一个PageBean对象
PageBean pb = ps.showAllProductWithPage(pageNum, pageSize);
//将pb放入request域中
request.setAttribute("pageBean",pb);
request.getRequestDispatcher("/page.jsp").forward(request,response);
}
}

@ -0,0 +1,35 @@
package dao;
/**
* AbstractProducts entity provides the base persistence definition of the
* Products entity. @author MyEclipse Persistence Tools
*/
public abstract class AbstractProducts implements java.io.Serializable {
// Fields
private ProductsId id;
// Constructors
/** default constructor */
public AbstractProducts() {
}
/** full constructor */
public AbstractProducts(ProductsId id) {
this.id = id;
}
// Property accessors
public ProductsId getId() {
return this.id;
}
public void setId(ProductsId id) {
this.id = id;
}
}

@ -0,0 +1,173 @@
package dao;
/**
* AbstractProductsId entity provides the base persistence definition of the
* ProductsId entity. @author MyEclipse Persistence Tools
*/
public abstract class AbstractProductsId implements java.io.Serializable {
// Fields
private Integer proId;
private Integer userId;
private String proName;
private String contact;
private Float price;
private Float oprice;
private Integer type;
private Integer classifyId;
// Constructors
/** default constructor */
public AbstractProductsId() {
}
/** minimal constructor */
public AbstractProductsId(Integer proId, Integer userId) {
this.proId = proId;
this.userId = userId;
}
/** full constructor */
public AbstractProductsId(Integer proId, Integer userId, String proName,
String contact, Float price, Float oprice, Integer type,
Integer classifyId) {
this.proId = proId;
this.userId = userId;
this.proName = proName;
this.contact = contact;
this.price = price;
this.oprice = oprice;
this.type = type;
this.classifyId = classifyId;
}
// Property accessors
public Integer getProId() {
return this.proId;
}
public void setProId(Integer proId) {
this.proId = proId;
}
public Integer getUserId() {
return this.userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getProName() {
return this.proName;
}
public void setProName(String proName) {
this.proName = proName;
}
public String getContact() {
return this.contact;
}
public void setContact(String contact) {
this.contact = contact;
}
public Float getPrice() {
return this.price;
}
public void setPrice(Float price) {
this.price = price;
}
public Float getOprice() {
return this.oprice;
}
public void setOprice(Float oprice) {
this.oprice = oprice;
}
public Integer getType() {
return this.type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getClassifyId() {
return this.classifyId;
}
public void setClassifyId(Integer classifyId) {
this.classifyId = classifyId;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof AbstractProductsId))
return false;
AbstractProductsId castOther = (AbstractProductsId) other;
return ((this.getProId() == castOther.getProId()) || (this.getProId() != null
&& castOther.getProId() != null && this.getProId().equals(
castOther.getProId())))
&& ((this.getUserId() == castOther.getUserId()) || (this
.getUserId() != null && castOther.getUserId() != null && this
.getUserId().equals(castOther.getUserId())))
&& ((this.getProName() == castOther.getProName()) || (this
.getProName() != null && castOther.getProName() != null && this
.getProName().equals(castOther.getProName())))
&& ((this.getContact() == castOther.getContact()) || (this
.getContact() != null && castOther.getContact() != null && this
.getContact().equals(castOther.getContact())))
&& ((this.getPrice() == castOther.getPrice()) || (this
.getPrice() != null && castOther.getPrice() != null && this
.getPrice().equals(castOther.getPrice())))
&& ((this.getOprice() == castOther.getOprice()) || (this
.getOprice() != null && castOther.getOprice() != null && this
.getOprice().equals(castOther.getOprice())))
&& ((this.getType() == castOther.getType()) || (this.getType() != null
&& castOther.getType() != null && this.getType()
.equals(castOther.getType())))
&& ((this.getClassifyId() == castOther.getClassifyId()) || (this
.getClassifyId() != null
&& castOther.getClassifyId() != null && this
.getClassifyId().equals(castOther.getClassifyId())));
}
public int hashCode() {
int result = 17;
result = 37 * result
+ (getProId() == null ? 0 : this.getProId().hashCode());
result = 37 * result
+ (getUserId() == null ? 0 : this.getUserId().hashCode());
result = 37 * result
+ (getProName() == null ? 0 : this.getProName().hashCode());
result = 37 * result
+ (getContact() == null ? 0 : this.getContact().hashCode());
result = 37 * result
+ (getPrice() == null ? 0 : this.getPrice().hashCode());
result = 37 * result
+ (getOprice() == null ? 0 : this.getOprice().hashCode());
result = 37 * result
+ (getType() == null ? 0 : this.getType().hashCode());
result = 37
* result
+ (getClassifyId() == null ? 0 : this.getClassifyId()
.hashCode());
return result;
}
}

@ -0,0 +1,16 @@
package dao;
import org.hibernate.Session;
/**
* Data access object (DAO) for domain model
* @author MyEclipse Persistence Tools
*/
public class BaseHibernateDAO implements IBaseHibernateDAO {
public Session getSession() {
return HibernateSessionFactory.getSession();
}
}

@ -0,0 +1,118 @@
package dao;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;
/**
* Configures and provides access to Hibernate sessions, tied to the
* current thread of execution. Follows the Thread Local Session
* pattern, see {@link http://hibernate.org/42.html }.
*/
public class HibernateSessionFactory {
/**
* Location of hibernate.cfg.xml file.
* Location should be on the classpath as Hibernate uses
* #resourceAsStream style lookup for its configuration file.
* The default classpath location of the hibernate config file is
* in the default package. Use #setConfigFile() to update
* the location of the configuration file for the current session.
*/
private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";
private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>();
private static Configuration configuration = new Configuration();
private static org.hibernate.SessionFactory sessionFactory;
private static String configFile = CONFIG_FILE_LOCATION;
static {
try {
configuration.configure(configFile);
sessionFactory = configuration.buildSessionFactory();
} catch (Exception e) {
System.err
.println("%%%% Error Creating SessionFactory %%%%");
e.printStackTrace();
}
}
private HibernateSessionFactory() {
}
/**
* Returns the ThreadLocal Session instance. Lazy initialize
* the <code>SessionFactory</code> if needed.
*
* @return Session
* @throws HibernateException
*/
public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
threadLocal.set(session);
}
return session;
}
/**
* Rebuild hibernate session factory
*
*/
public static void rebuildSessionFactory() {
try {
configuration.configure(configFile);
sessionFactory = configuration.buildSessionFactory();
} catch (Exception e) {
System.err
.println("%%%% Error Creating SessionFactory %%%%");
e.printStackTrace();
}
}
/**
* Close the single hibernate session instance.
*
* @throws HibernateException
*/
public static void closeSession() throws HibernateException {
Session session = (Session) threadLocal.get();
threadLocal.set(null);
if (session != null) {
session.close();
}
}
/**
* return session factory
*
*/
public static org.hibernate.SessionFactory getSessionFactory() {
return sessionFactory;
}
/**
* return session factory
*
* session factory will be rebuilded in the next call
*/
public static void setConfigFile(String configFile) {
HibernateSessionFactory.configFile = configFile;
sessionFactory = null;
}
/**
* return hibernate configuration
*
*/
public static Configuration getConfiguration() {
return configuration;
}
}

@ -0,0 +1,12 @@
package dao;
import org.hibernate.Session;
/**
* Data access interface for domain model
* @author MyEclipse Persistence Tools
*/
public interface IBaseHibernateDAO {
public Session getSession();
}

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="hib.Products" table="products" catalog="myday">
<composite-id name="id" class="hib.ProductsId">
<key-property name="proId" type="java.lang.Integer">
<column name="proId" />
</key-property>
<key-property name="userId" type="java.lang.Integer">
<column name="userId" />
</key-property>
<key-property name="proName" type="java.lang.String">
<column name="proName" />
</key-property>
<key-property name="contact" type="java.lang.String">
<column name="contact" />
</key-property>
<key-property name="price" type="java.lang.Float">
<column name="price" precision="12" scale="0" />
</key-property>
<key-property name="oprice" type="java.lang.Float">
<column name="oprice" precision="12" scale="0" />
</key-property>
<key-property name="type" type="java.lang.Integer">
<column name="type" />
</key-property>
<key-property name="classifyId" type="java.lang.Integer">
<column name="classifyId" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>

@ -0,0 +1,19 @@
package dao;
/**
* Products entity. @author MyEclipse Persistence Tools
*/
public class Products extends AbstractProducts implements java.io.Serializable {
// Constructors
/** default constructor */
public Products() {
}
/** full constructor */
public Products(ProductsId id) {
super(id);
}
}

@ -0,0 +1,135 @@
package dao;
import java.util.List;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A data access object (DAO) providing persistence and search support for
* Products entities. Transaction control of the save(), update() and delete()
* operations can directly support Spring container-managed transactions or they
* can be augmented to handle user-managed Spring transactions. Each of these
* methods provides additional information for how to configure it for the
* desired type of transaction control.
*
* @see hib.Products
* @author MyEclipse Persistence Tools
*/
public class ProductsDAO extends BaseHibernateDAO {
private static final Logger log = LoggerFactory
.getLogger(ProductsDAO.class);
// property constants
public void save(Products transientInstance) {
log.debug("saving Products instance");
try {
getSession().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Products persistentInstance) {
log.debug("deleting Products instance");
try {
getSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Products findById(dao.ProductsId id) {
log.debug("getting Products instance with id: " + id);
try {
Products instance = (Products) getSession().get("hib.Products", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Products instance) {
log.debug("finding Products instance by example");
try {
List results = getSession().createCriteria("hib.Products")
.add(Example.create(instance)).list();
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Products instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Products as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findAll() {
log.debug("finding all Products instances");
try {
String queryString = "from Products";
Query queryObject = getSession().createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Products merge(Products detachedInstance) {
log.debug("merging Products instance");
try {
Products result = (Products) getSession().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Products instance) {
log.debug("attaching dirty Products instance");
try {
getSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Products instance) {
log.debug("attaching clean Products instance");
try {
getSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
}

@ -0,0 +1,27 @@
package dao;
/**
* ProductsId entity. @author MyEclipse Persistence Tools
*/
public class ProductsId extends AbstractProductsId implements
java.io.Serializable {
// Constructors
/** default constructor */
public ProductsId() {
}
/** minimal constructor */
public ProductsId(Integer proId, Integer userId) {
super(proId, userId);
}
/** full constructor */
public ProductsId(Integer proId, Integer userId, String proName,
String contact, Float price, Float oprice, Integer type,
Integer classifyId) {
super(proId, userId, proName, contact, price, oprice, type, classifyId);
}
}

@ -0,0 +1,26 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/myday
</property>
<property name="connection.username">root</property>
<property name="connection.password">mysql123</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="myeclipse.connection.profile">myday</property>
<mapping resource="hib/Products.hbm.xml" />
</session-factory>
</hibernate-configuration>

@ -0,0 +1,129 @@
package model;
import java.util.List;
public class PageBean<T> {
private int pageNum; //当前页,从请求那边传过来。
private int pageSize; //每页显示的数据条数。
private int totalRecord; //总的记录条数。查询数据库得到的数据
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalRecord() {
return totalRecord;
}
public void setTotalRecord(int totalRecord) {
this.totalRecord = totalRecord;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getStartIndex() {
return startIndex;
}
public void setStartIndex(int startIndex) {
this.startIndex = startIndex;
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getEnd() {
return end;
}
public void setEnd(int end) {
this.end = end;
}
//需要计算得来
private int totalPage; //总页数通过totalRecord和pageSize计算可以得来
//开始索引也就是我们在数据库中要从第几行数据开始拿有了startIndex和pageSize
//就知道了limit语句的两个数据就能获得每页需要显示的数据了
private int startIndex;
//将每页要显示的数据放在list集合中
private List<T> list;
//分页显示的页数,比如在页面上显示12345页start就为1end就为5这个也是算过来的
private int start;
private int end;
//通过pageNumpageSizetotalRecord计算得来tatalPage和startIndex
//构造方法中将pageNumpageSizetotalRecord获得
public PageBean(int pageNum,int pageSize,int totalRecord) {
this.pageNum = pageNum;
this.pageSize = pageSize;
this.totalRecord = totalRecord;
//totalPage 总页数
if(totalRecord%pageSize==0){
//说明整除正好每页显示pageSize条数据没有多余一页要显示少于pageSize条数据的
this.totalPage = totalRecord / pageSize;
}else{
//不整除,就要在加一页,来显示多余的数据。
this.totalPage = totalRecord / pageSize +1;
}
//开始索引
this.startIndex = (pageNum-1)*pageSize ;
//显示5页
this.start = 1;
this.end = 5;
//显示页数的算法
if(totalPage <=5){
//总页数都小于5那么end就为总页数的值了。
this.end = this.totalPage;
}else{
//总页数大于5那么就要根据当前是第几页来判断start和end为多少了
this.start = pageNum - 2;
this.end = pageNum + 2;
if(start <= 0){
//比如当前页是第1页或者第2页那么就不符合这个规则
this.start = 1;
this.end = 5;
}
if(end > this.totalPage){
//比如当前页是倒数第2页或者最后一页也同样不符合上面这个规则
this.end = totalPage;
this.start = end - 5;
}
}
}
}

@ -0,0 +1,56 @@
package model;
public class Product {
private int proId;
private int userId;
private String proName; //物品名称
private String contact; //卖家联系方式
private float price; //转卖价
private float oprice; //原价
private int classifyId; //分类
private int type;
public int getProId() {
return proId;
}
public void setProId(int proId) {
this.proId = proId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getProName() {
return proName;
}
public void setProName(String proName) {
this.proName = proName;
}
public String getContact() {
return contact;
}
public void setContact(String contact) {
this.contact = contact;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public float getOprice() {
return oprice;
}
public void setOprice(float oprice) {
this.oprice = oprice;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}

@ -0,0 +1,27 @@
package service;
import dao.ProductsDAO;
import java.util.List;
import model.PageBean;
import model.Product;
public class ProductService {
@SuppressWarnings("unchecked")
public PageBean<Product> showAllProductWithPage(int pageNum,int pageSize){
ProductsDAO pro=new ProductsDAO();
List<Product> allProduct = pro.findAll();
int totalRecord = allProduct.size();
PageBean pb= new PageBean(pageNum,pageSize,totalRecord);
int startIndex = pb.getStartIndex();
// pb.setList(ProductsDAO.findAll(startIndex,pageSize));
pb.setList(pro.findAll());
return pb;
}
}

@ -1,18 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head><title>用户注册</title></head>
<body>
<p>注册一个新用户</p>
<s:form action="Register">
<s:actionerror /><s:fielderror />
<s:textfield name="user.username" label="用户名" />
<s:password name="user.password" label="口令" />
<s:textfield name="user.age" label="年龄" />
<s:textfield name="user.email" label="Email地址" />
<s:submit value="登录" />
</s:form>
</body></html>

@ -0,0 +1,66 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.HibernateSessionFactory;
import com.Userinfo;
import com.Xz;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import com.opensymphony.xwork2.ActionSupport;
public class HelloServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
listStudent( request, response);
}
public void listStudent(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int xid=Integer.parseInt(request.getParameter("id"));
/* try{
xid=Integer.parseInt(request.getParameter("id"));
}catch(NumberFormatException e){
}*/
Session session=HibernateSessionFactory.getSession();
Transaction tx=null;
List<Xz> xz=null;
try{
tx=session.beginTransaction();
Query query=session.createQuery("FROM Xz xz where xz.id=:xid");
query.setParameter("xid", Integer.parseInt(request.getParameter("id")));
xz=query.list();
tx.commit();
}catch(HibernateException e){
if(tx!=null) tx.rollback();
e.printStackTrace();
}finally{
session.close();
}
if(xz!=null){
request.setAttribute("xz", xz);
RequestDispatcher rd=request.getRequestDispatcher("xzxq.jsp");
rd.forward(request, response);
}
}
}

@ -1,6 +1,8 @@
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import org.hibernate.Transaction;

@ -0,0 +1,47 @@
import java.util.List;
import javax.persistence.ManyToOne;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.HibernateSessionFactory;
import com.Qg;
import com.opensymphony.xwork2.ActionSupport;
public class SubmitQgAction extends ActionSupport {
@ManyToOne
private Qg qg;
public Qg getQg() {
return qg;
}
public void setQg(Qg qg) {
this.qg = qg;
}
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
return SUCCESS;
}
public String submit() throws Exception{
try{
Session session=HibernateSessionFactory.getSession();
Transaction tx=session.beginTransaction();
session.save(qg);
tx.commit();
return SUCCESS;
}catch(Exception e){
e.printStackTrace();
HibernateSessionFactory.getSession().close();
return ERROR;
}
}
}

@ -1,12 +1,20 @@
import org.hibernate.Session;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import org.hibernate.Transaction;
import com.Xz;
import org.hibernate.Query;
import org.hibernate.Session;
import com.HibernateSessionFactory;
import com.Xz;
import com.opensymphony.xwork2.ActionSupport;
@Entity
public class SubmitXzAction extends ActionSupport {
@ManyToOne
private Xz xz;
public Xz getXz() {
@ -22,19 +30,26 @@ public class SubmitXzAction extends ActionSupport {
// TODO Auto-generated method stub
return SUCCESS;
}
public String submit() throws Exception{
try{
Session session=HibernateSessionFactory.getSession();
Transaction tx=session.beginTransaction();
session.save(xz);
System.out.println("555555555555555555555555555555555");
tx.commit();
return SUCCESS;
}catch(Exception e){
System.out.println("222222222222222222222222222222222222222222222222222222222222222222222222222222");
e.printStackTrace();
HibernateSessionFactory.getSession().close();
return ERROR;
}
}
}

@ -0,0 +1,72 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
//import com.mysql.jdbc.Connection;
//import com.sun.corba.se.pept.transport.Connection;
public class XzListServlet extends HttpServlet {
/**
* Constructor of the object.
*/
public XzListServlet() {
super();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String uri=request.getRequestURI();
if(uri.endsWith("/XzListServlet")){
showProductDetails(request,response);
}
}
private void showProductDetails(HttpServletRequest request,HttpServletResponse response)
throws IOException{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out =response.getWriter();
int productId=0;
try{
productId=Integer.parseInt(request.getParameter("id"));
}catch(NumberFormatException e){
out.print(productId);
}
}
}

@ -0,0 +1,96 @@
package com;
/**
* AbstractQg entity provides the base persistence definition of the Qg entity. @author
* MyEclipse Persistence Tools
*/
public abstract class AbstractQg implements java.io.Serializable {
// Fields
private Integer id;
private String title;
private String miao;
private Integer price;
private String wx;
private String tel;
private String qq;
// Constructors
/** default constructor */
public AbstractQg() {
}
/** full constructor */
public AbstractQg(String title,String miao, Integer price, String wx, String tel,
String qq) {
this.title=title;
this.miao = miao;
this.price = price;
this.wx = wx;
this.tel = tel;
this.qq = qq;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMiao() {
return this.miao;
}
public void setMiao(String miao) {
this.miao = miao;
}
public Integer getPrice() {
return this.price;
}
public void setPrice(Integer price) {
this.price = price;
}
public String getWx() {
return this.wx;
}
public void setWx(String wx) {
this.wx = wx;
}
public String getTel() {
return this.tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getQq() {
return this.qq;
}
public void setQq(String qq) {
this.qq = qq;
}
}

@ -9,9 +9,9 @@ public abstract class AbstractXz implements java.io.Serializable {
// Fields
// private Integer id;
private Integer id;
private String title;
private String desc;
private String miao;
private Integer sep;
private Integer orp;
private String postage;
@ -26,18 +26,18 @@ public abstract class AbstractXz implements java.io.Serializable {
}
/** minimal constructor */
public AbstractXz(String title, Integer sep) {
// this.id=id;
public AbstractXz(Integer id, String title, Integer sep) {
this.id = id;
this.title = title;
this.sep = sep;
}
/** full constructor */
public AbstractXz(String title, String desc, Integer sep, Integer orp,
String postage, String wx, String tel, String qq) {
public AbstractXz(String title, String miao, Integer sep,
Integer orp, String postage, String wx, String tel, String qq) {
this.title = title;
this.desc = desc;
this.miao = miao;
this.sep = sep;
this.orp = orp;
this.postage = postage;
@ -48,15 +48,18 @@ public abstract class AbstractXz implements java.io.Serializable {
// Property accessors
/* public Integer getId() {
public Integer getId() {
System.out.println(this.id);
return this.id;
}
public void setId(Integer id) {
this.id = id;
}*/
}
public String getTitle() {
System.out.println(this.title);
return this.title;
}
@ -64,15 +67,19 @@ public abstract class AbstractXz implements java.io.Serializable {
this.title = title;
}
public String getDesc() {
return this.desc;
public String getMiao() {
System.out.println(this.miao);
return this.miao;
}
public void setDesc(String desc) {
this.desc = desc;
public void setMiao(String miao) {
this.miao = miao;
}
public Integer getSep() {
System.out.println(this.sep);
return this.sep;
}
@ -81,6 +88,8 @@ public abstract class AbstractXz implements java.io.Serializable {
}
public Integer getOrp() {
System.out.println(this.orp);
return this.orp;
}
@ -89,6 +98,8 @@ public abstract class AbstractXz implements java.io.Serializable {
}
public String getPostage() {
System.out.println(this.postage);
return this.postage;
}
@ -97,6 +108,8 @@ public abstract class AbstractXz implements java.io.Serializable {
}
public String getWx() {
System.out.println(this.wx);
return this.wx;
}
@ -105,6 +118,8 @@ public abstract class AbstractXz implements java.io.Serializable {
}
public String getTel() {
System.out.println(this.tel);
return this.tel;
}
@ -113,6 +128,8 @@ public abstract class AbstractXz implements java.io.Serializable {
}
public String getQq() {
System.out.println(this.qq);
return this.qq;
}

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.Qg" table="qg" catalog="postgres">
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="identity" />
</id>
<property name="title" type="java.lang.String">
<column name="title" length="45" />
</property>
<property name="miao" type="java.lang.String">
<column name="miao" length="45" />
</property>
<property name="price" type="java.lang.Integer">
<column name="price" />
</property>
<property name="wx" type="java.lang.String">
<column name="wx" length="45" />
</property>
<property name="tel" type="java.lang.String">
<column name="tel" length="45" />
</property>
<property name="qq" type="java.lang.String">
<column name="qq" length="45" />
</property>
</class>
</hibernate-mapping>

@ -0,0 +1,19 @@
package com;
/**
* Qg entity. @author MyEclipse Persistence Tools
*/
public class Qg extends AbstractQg implements java.io.Serializable {
// Constructors
/** default constructor */
public Qg() {
}
/** full constructor */
public Qg(String title,String miao, Integer price, String wx, String tel, String qq) {
super(title,miao, price, wx, tel, qq);
}
}

@ -11,13 +11,13 @@
<generator class="identity" />
</id>
<property name="title" type="java.lang.String">
<column name="title" length="45" not-null="true" />
<column name="title" length="45" />
</property>
<property name="desc" type="java.lang.String">
<column name="desc" length="45" />
<property name="miao" type="java.lang.String">
<column name="miao" length="45" />
</property>
<property name="sep" type="java.lang.Integer">
<column name="sep" not-null="true" />
<column name="sep" />
</property>
<property name="orp" type="java.lang.Integer">
<column name="orp" />

@ -12,14 +12,14 @@ public class Xz extends AbstractXz implements java.io.Serializable {
}
/** minimal constructor */
public Xz( String title, Integer sep) {
super(title, sep);
public Xz(Integer id, String title, Integer sep) {
super(id, title, sep);
}
/** full constructor */
public Xz(String title, String desc, Integer sep, Integer orp,
public Xz(String title, String miao, Integer sep, Integer orp,
String postage, String wx, String tel, String qq) {
super(title, desc, sep, orp, postage, wx, tel, qq);
super(title, miao, sep, orp, postage, wx, tel, qq);
}
}

@ -24,6 +24,7 @@
<property name="connection.autocommit">true</property>
<mapping resource="com/Userinfo.hbm.xml" />
<mapping resource="com/Xz.hbm.xml" />
<mapping resource="com/Qg.hbm.xml" />
</session-factory>

@ -23,6 +23,10 @@
<result name="success">/welcome.jsp</result>
<result name="error">/success.jsp</result></action>
<action name="Fbqg" class="SubmitQgAction" method="submit">
<result name="success">/welcome.jsp</result>
<result name="error">/success.jsp</result></action>
</package>

@ -1,9 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head><title>注册成功页面</title></head>
<body>
<p>注册成功</p>
<s:property value="user" />
<p><a href="<s:url action='index' />" >返回首页</a></p>
</body></html>

@ -1,7 +0,0 @@
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html>
<head><title>登陆成功</title></head>
<body>
<p align="center"><font color="#000080" size="5">欢迎登陆本系统</font></p>
</body></html>
Loading…
Cancel
Save