@ -0,0 +1,13 @@
|
||||
<?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_EM"/>
|
||||
<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-bin.jar"/>
|
||||
<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.struts2.MYECLIPSE_STRUTS21_CORE"/>
|
||||
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PropertiesComponent">
|
||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,24 @@
|
||||
#MyEclipse Hibernate Properties
|
||||
#Fri Jan 03 19:00:56 CST 2020
|
||||
sessionFactoryName=
|
||||
genBasicCompId=true
|
||||
profile=
|
||||
daoSFId=
|
||||
version=3.3
|
||||
jndiPath=
|
||||
detectM2M=false
|
||||
reStrategyClass=
|
||||
detectO2O=false
|
||||
springDaoFile=
|
||||
useJavaTypes=true
|
||||
keyGenerator=native
|
||||
libInstallFolder=WebRoot/WEB-INF/lib
|
||||
addLibs2Project=true
|
||||
genVersionTag=false
|
||||
sessionFactoryId=
|
||||
basePersistenceClass=
|
||||
genAnnotations=false
|
||||
reSettingsFile=
|
||||
configFile=/Lesson12/src/hibernate.cfg.xml
|
||||
createConfigFile=true
|
||||
addLibs2Classpath=true
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-module
|
||||
type="WEB"
|
||||
name="Lesson12"
|
||||
id="myeclipse.1559700929068"
|
||||
context-root="/Lesson12"
|
||||
j2ee-spec="5.0"
|
||||
archive="Lesson12.war">
|
||||
<attributes>
|
||||
<attribute name="webrootdir" value="WebRoot" />
|
||||
</attributes>
|
||||
</project-module>
|
||||
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MyEclipseStrutsProperties>
|
||||
<strutsVersion>4</strutsVersion>
|
||||
<basePackage></basePackage>
|
||||
<strutsPattern>0</strutsPattern>
|
||||
<servletName>action</servletName>
|
||||
</MyEclipseStrutsProperties>
|
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Lesson12</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>
|
||||
<nature>com.genuitec.eclipse.cross.easystruts.eclipse.easystrutsnature</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,8 @@
|
||||
#Wed Jun 05 10:15:29 CST 2019
|
||||
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.compliance=1.6
|
||||
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="Lesson12">
|
||||
<wb-resource deploy-path="/" source-path="/WebRoot"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
|
||||
<property name="context-root" value="/Lesson12"/>
|
||||
<property name="java-output-path" value="/Lesson12/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.6"/>
|
||||
<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 @@
|
||||
Window
|
@ -0,0 +1,249 @@
|
||||
<%@ 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,570 @@
|
||||
<%@ 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>MyDay-我的美好一天</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="js/jquery-1.11.3.js"></script>
|
||||
|
||||
</head>
|
||||
<style>
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.newheader{
|
||||
height: 60px;
|
||||
background-color: #00CD66;
|
||||
width:1520px;
|
||||
position: fixed;
|
||||
z-index: 11;
|
||||
}
|
||||
.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%;
|
||||
|
||||
}
|
||||
.homeback{
|
||||
z-index: -1;
|
||||
|
||||
position:absolute;
|
||||
width:1520px;
|
||||
height:2440px;
|
||||
top:60px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<body>
|
||||
<img class="homeback" alt="" src="./img/home.png" style="z-index: -1">
|
||||
<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="./market.jsp" >跳蚤市场</a>
|
||||
</li>
|
||||
<li class="pr" style="display: block;">
|
||||
<a href="./404.jsp" >校园超市</a>
|
||||
</li>
|
||||
<li class="pr" style="display: block;">
|
||||
<a href="./LostAndFound.jsp">失物招领</a>
|
||||
</li>
|
||||
<li class="pr" style="display: block;">
|
||||
<a href="./404.jsp">资源共享</a>
|
||||
</li>
|
||||
<li class="pr" style="display: block;">
|
||||
<a href="./404.jsp">兴趣论坛</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<span class="login pr" style="float: right;">
|
||||
<a href="./1.jsp" class="mr5 color-white" >登录</a>
|
||||
<em class="vertical-line" ></em>
|
||||
<a href="/register" class="mr5 color-white">注册</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- 以上导航 -->
|
||||
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
*::selection{
|
||||
background: none;
|
||||
}
|
||||
#box ul li{
|
||||
margin: 0;
|
||||
padding:0;
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
line-height: 270px;
|
||||
font-size: 30px;
|
||||
}
|
||||
#box{
|
||||
width:650px;
|
||||
height:320px;
|
||||
position:relative;
|
||||
bottom: -180px;
|
||||
}
|
||||
#box li{
|
||||
width:100%;
|
||||
height:100%;
|
||||
position:absolute;
|
||||
opacity:0;
|
||||
transition:1s;
|
||||
|
||||
}
|
||||
#box ul li:FIRST-CHILD {
|
||||
opacity:1;
|
||||
}
|
||||
.btn{
|
||||
witdh:80px;
|
||||
height:30px;
|
||||
background: rgba(0,0,0,0);
|
||||
color:#fff;
|
||||
top:135px;
|
||||
position:absolute;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#nextt{
|
||||
right:0;
|
||||
}
|
||||
.btn:HOVER {
|
||||
background: rgba(0,0,0,0.05);
|
||||
}
|
||||
.btn:ACTIVE {
|
||||
background: rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.shouye{
|
||||
height:500px;
|
||||
position: relative;
|
||||
width:1520px;
|
||||
}
|
||||
.sub{
|
||||
width:100px;
|
||||
height:35px;
|
||||
border-radius:7px;
|
||||
border: none;
|
||||
background: #FFB90F;
|
||||
color: white;
|
||||
font-size:120%;
|
||||
letter-spacing: 4px;
|
||||
display: inline-block;
|
||||
text-align:center;
|
||||
vertical-align: middle;
|
||||
margin-top: 20px;
|
||||
padding-top:5px;
|
||||
outline: none;
|
||||
position: relative;
|
||||
top:180px;
|
||||
left:250px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.sub:HOVER{
|
||||
background: #EEAD0E;
|
||||
}
|
||||
.sub:ACTIVE{
|
||||
background: #FFB90F;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<div class="shouye">
|
||||
<a href="./1.jsp" class="sub" >登录</a>
|
||||
<div id="box">
|
||||
<ul>
|
||||
<li class="ll" id=0>美好的一天从MyDay开始</li>
|
||||
<li class="ll" id=1>校园超市为你方便购物</li>
|
||||
<li class="ll" id=2>失物招领让你的宝贝回家</li>
|
||||
<li class="ll" id=2>资源共享丰富你的知识</li>
|
||||
<li class="ll" id=2>跳蚤市场轻松解决你不需要的物品</li>
|
||||
</ul>
|
||||
<div class="btn" id="prevv" onclick="clickprev()">prev</div>
|
||||
<div class="btn" id="nextt" onclick="clicknext()">next</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var ll = document.getElementsByClassName("ll");
|
||||
var pre = document.getElementById("prevv");
|
||||
var next = document.getElementById("nextt");
|
||||
var index = 0;
|
||||
var int;
|
||||
|
||||
//定时器
|
||||
|
||||
|
||||
int=self.setInterval("wrapernext()",3000);
|
||||
|
||||
|
||||
|
||||
//3秒后开始定时
|
||||
//setTimeout("SetInterval()",3000);
|
||||
|
||||
|
||||
function wrapernext(){
|
||||
index++;
|
||||
if(index == ll.length) index=0;
|
||||
console.log(ll.length);
|
||||
for(var i=0;i<ll.length;i++){
|
||||
ll[i].style.opacity=0;
|
||||
}
|
||||
ll[index].style.opacity=1;
|
||||
};
|
||||
|
||||
function clicknext(){
|
||||
window.clearInterval(int) ;
|
||||
int=null;
|
||||
wrapernext();
|
||||
if(int==null){
|
||||
int=self.setInterval("wrapernext()",3000);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function wraperprev(){
|
||||
index--;
|
||||
if(index == -1) index=ll.length-1;
|
||||
console.log(ll.length);
|
||||
for(var i=0;i<ll.length;i++){
|
||||
ll[i].style.opacity=0;
|
||||
}
|
||||
ll[index].style.opacity=1;
|
||||
};
|
||||
|
||||
|
||||
function clickprev(){
|
||||
window.clearInterval(int) ;
|
||||
int=null;
|
||||
wraperprev();
|
||||
if(int==null){
|
||||
int=self.setInterval("wrapernext()",3000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!-- 以上是主题介绍 -->
|
||||
|
||||
<!--
|
||||
<style>
|
||||
.adv{
|
||||
: 4px solid yellow;
|
||||
position: relative;
|
||||
height: 600px;
|
||||
}
|
||||
.circle{
|
||||
width:150px;
|
||||
height:150px;
|
||||
border-radius:50%;
|
||||
background: #48D1CC;
|
||||
position: relative;
|
||||
float:left;
|
||||
color:white;
|
||||
line-height:120px;
|
||||
display:inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
.cir-one,.cir-one+a{
|
||||
left:150px;
|
||||
}
|
||||
.cir-two,.cir-two+a{
|
||||
right:-700px;
|
||||
}
|
||||
.cir-three,.cir-three+a{
|
||||
left:350px;
|
||||
}
|
||||
.cir-four,.cir-four+a{
|
||||
right:-1200px;
|
||||
}
|
||||
.good{
|
||||
: 4px solid yellow;
|
||||
float:left;
|
||||
color:#ADD8E6;
|
||||
position:relative;
|
||||
display:inline-block;
|
||||
}
|
||||
.inline{
|
||||
height:150px;
|
||||
padding: 0px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<div class="adv">
|
||||
<div style="border: 1px solid red;" class="inline">
|
||||
<div class="circle cir-one">跳蚤市场</div>
|
||||
<a class="good">
|
||||
很好不错特别棒
|
||||
</a>
|
||||
</div>
|
||||
<div style="border: 1px solid red;" class="inline">
|
||||
<div class="circle cir-two">校园超市</div>
|
||||
<a class="good">
|
||||
很好不错特别棒
|
||||
</a>
|
||||
</div>
|
||||
<div style="border: 1px solid red;" class="inline">
|
||||
<div class="circle cir-three">失物招领</div>
|
||||
<a class="good">
|
||||
很好不错特别棒
|
||||
</a>
|
||||
</div>
|
||||
<div style="border: 1px solid red;" class="inline">
|
||||
<div class="circle cir-four">资源共享</div>
|
||||
<a class="good">
|
||||
很好不错特别棒
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- background-image:url('./img/timg.jfif');
|
||||
-->
|
||||
|
||||
|
||||
<!-- 以下功能介绍 -->
|
||||
|
||||
<style>
|
||||
.backch{
|
||||
width:1520px;
|
||||
height:620px;
|
||||
position: relative;
|
||||
bottom: -830px;
|
||||
background-image: url('./img/hover.jpg');
|
||||
background-repeat: no-repeat;
|
||||
background-size:cover;
|
||||
}
|
||||
.homepage_introduce{
|
||||
|
||||
position: relative;
|
||||
bottom: -950px;
|
||||
width:1520px;
|
||||
height:360px;
|
||||
|
||||
}
|
||||
|
||||
.active{
|
||||
width: 258.4px;
|
||||
height: 300px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
background-size:contain;
|
||||
background-repeat:no-repeat;
|
||||
z-index:2;
|
||||
border-radius:10px;
|
||||
margin-top: 30px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.action img{
|
||||
width: 258.4px;
|
||||
height: 300px;
|
||||
position: relative;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/*
|
||||
.active:HOVER{
|
||||
background-image: linear-gradient(45deg, #FBDA61 0%, #FF5ACD 100% );
|
||||
background:rgba(,,,0.1);
|
||||
color:white;
|
||||
height: 320px;
|
||||
margin-top: 20px;
|
||||
}*/
|
||||
.homepage_introduce ul{
|
||||
list-style-type:none;
|
||||
padding-top: 0;
|
||||
position:relative;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
height:360px;
|
||||
width:1520px;
|
||||
}
|
||||
.colorWhite{
|
||||
text-decoration: none;
|
||||
|
||||
}
|
||||
|
||||
.active div{
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="backch">
|
||||
<div class="homepage_introduce" >
|
||||
|
||||
<ul>
|
||||
<li class="active one" onmouseenter="onmove(this,'hover1') " onmouseleave="onout(this,'hover1')" >
|
||||
<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" onmouseenter="onmove(this,'hover2') " onmouseleave="onout(this,'hover2')" >
|
||||
<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" onmouseenter="onmove(this,'hover3') " onmouseleave="onout(this,'hover3')" >
|
||||
<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" onmouseenter="onmove(this,'hover4') " onmouseleave="onout(this,'hover4')" >
|
||||
<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" onmouseenter="onmove(this,'hover') " onmouseleave="onout(this,'hover')" ">
|
||||
<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>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function onmove(x,ho){
|
||||
x.style.visibility="hidden";
|
||||
document.getElementById(ho).style.visibility="visible";
|
||||
|
||||
}
|
||||
function onout(x,ho){
|
||||
x.style.visibility="visible";
|
||||
document.getElementById(ho).style.visibility="hidden";
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<!--
|
||||
|
||||
<ul >
|
||||
<li class="active">
|
||||
<div>
|
||||
<p class="f18 floatingName"><a href="https://www.trustie.net" class="colorWhite">TrustieForge</a></p>
|
||||
<p class="f16 mb20"></p>
|
||||
<p class="f12 mb30 break_full_word floatingContent">开源创作与软件生产相结合,支持大规模群体开展软件协同创新活动。</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="active">
|
||||
<div>
|
||||
<p class="f18 floatingName"><a href="http://codepedia.trustie.net/" class="colorWhite">Codepedia</a></p>
|
||||
<p class="f16 mb20">众包标注平台</p>
|
||||
<p class="f12 mb30 break_full_word floatingContent">也为软件领域积累丰富的自然语言标注。</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="active">
|
||||
<div>
|
||||
<p class="f18 floatingName"><a href="https://www.trustie.net" class="colorWhite">TrustieForge</a></p>
|
||||
<p class="f16 mb20"></p>
|
||||
<p class="f12 mb30 break_full_word floatingContent"></p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="active">
|
||||
<div>
|
||||
<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>
|
||||
<p class="f18 floatingName"><a href="https://www.trustie.net" class="colorWhite">TrustieForge</a></p>
|
||||
<p class="f16 mb20"></p>
|
||||
<p class="f12 mb30 break_full_word floatingContent"></p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,317 @@
|
||||
<%@ 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:0 150px;
|
||||
height:100%;
|
||||
width:100%;
|
||||
}
|
||||
.logback{
|
||||
padding-top:0.5px;
|
||||
border-radius:7px;
|
||||
width:450px;
|
||||
height:600px;
|
||||
margin-left: 300px;
|
||||
z-index: 6;
|
||||
background: #F8F8FF;
|
||||
opacity:0.95;
|
||||
box-shadow:10px 10px 20px 10px rgba(220 ,220 ,220,0.5)
|
||||
}
|
||||
.loginform{
|
||||
position: relative;
|
||||
width:350px;
|
||||
margin:auto auto;
|
||||
margin-top: 12%;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
select:FOCUS{
|
||||
background: white;
|
||||
outline-color: #FFB90F;
|
||||
}
|
||||
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:HOVER{
|
||||
background: #EEAD0E;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
select {
|
||||
|
||||
width:350px;
|
||||
height:43px;
|
||||
margin-bottom: 20px;
|
||||
background: rgb(235 ,235, 235);
|
||||
border: none;
|
||||
}
|
||||
#tip{
|
||||
display: block;
|
||||
}
|
||||
|
||||
</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="logback">
|
||||
<div class="loginform">
|
||||
<div class="logtype">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="register">注册</a>
|
||||
</div>
|
||||
|
||||
<s:form action="Register" method="post" autocomplete="on">
|
||||
<s:textfield name="user.username" cssClass="info" placeholder="请使用用户名进行注册" /><br/>
|
||||
<s:password name="user.password" cssClass="info" placeholder="设置新密码" id="pwd1" /><br/>
|
||||
<input type="password" class="info" placeholder="再次输入密码" id="pwd2" required/ onkeyup="validate()"><br/>
|
||||
|
||||
<s:textfield name="user.age" label="年龄" />
|
||||
<s:textfield name="user.email" label="Email地址" />
|
||||
|
||||
<a id="tip"><font color='red' style='visibility: hidden;'>12</font></a>
|
||||
<input type="submit" id="submit" class="sub" onkeyup="" value="注册" />
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
function validate() {
|
||||
var pwd1 = document.getElementById("pwd1").value;
|
||||
var pwd2 = document.getElementById("pwd2").value;
|
||||
console.log(pwd1);
|
||||
|
||||
if(pwd1 == pwd2) {
|
||||
document.getElementById("tip").innerHTML="<font color='green'>√</font>";
|
||||
if(document.getElementById("submit").disabled==null)
|
||||
console.log("null");
|
||||
else console.log("not null");
|
||||
document.getElementById("submit").disabled = false;
|
||||
document.getElementById("submit").style.background="#FFB90F";
|
||||
console.log("same");
|
||||
}else if(pwd2=="")
|
||||
{
|
||||
document.getElementById("tip").innerHTML="<font color='red' style='visibility: hidden;'>12</font>";
|
||||
|
||||
}
|
||||
else {
|
||||
console.log("same");
|
||||
document.getElementById("tip").innerHTML="<font color='red'>两次密码不相同</font>";
|
||||
|
||||
document.getElementById("submit").disabled=true;
|
||||
document.getElementById("submit").style.background="rgb(235 ,235, 235)";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="reg">
|
||||
<p>注册</p>
|
||||
<p>忘记密码</p>
|
||||
</div>
|
||||
|
||||
</s:form>
|
||||
<p style="text-align: center;font-family:cursive;">———其他登录方式 ———</p>
|
||||
|
||||
</div>
|
||||
</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,799 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/p5.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.12.0/matter.min.js"></script>
|
||||
|
||||
<div class="height-warning"></div>
|
||||
<style>
|
||||
/* apply a natural box layout model to all elements, but allowing components to change */
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body {
|
||||
background-image: url('./img/404.png');
|
||||
background-repeat:repeat-y;
|
||||
background-attachment:fixed;
|
||||
background-position:center;
|
||||
}
|
||||
|
||||
canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.height-warning {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: #fee096 url(http://www.jq22.com/tp/6370907262946157816840415.png) center no-repeat;
|
||||
background-size: auto 40%;
|
||||
opacity: 0;
|
||||
transition: opacity 0.4s;
|
||||
pointer-events: none;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
@media(max-height: 499px) {
|
||||
.height-warning {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.instructions {
|
||||
display: none;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.instructions a {
|
||||
color: #7f6e4a;
|
||||
}
|
||||
|
||||
@media(min-width: 768px) {
|
||||
.instructions {
|
||||
z-index: 5;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
color: #000000;
|
||||
display: block;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.010em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
// Module aliases
|
||||
var Engine = Matter.Engine,
|
||||
World = Matter.World,
|
||||
Bodies = Matter.Bodies,
|
||||
Body = Matter.Body,
|
||||
Constraint = Matter.Constraint,
|
||||
Composite = Matter.Composite,
|
||||
Composites = Matter.Composites,
|
||||
MouseConstraint = Matter.MouseConstraint,
|
||||
Mouse = Matter.Mouse,
|
||||
Events = Matter.Events,
|
||||
Vertices = Matter.Vertices;
|
||||
|
||||
var engine = Engine.create();
|
||||
var world = engine.world;
|
||||
|
||||
var floor;
|
||||
var cup;
|
||||
var cupLeft;
|
||||
var cupRight;
|
||||
var cupHandle;
|
||||
|
||||
var chain = null;
|
||||
var heatLines = [];
|
||||
|
||||
var distanceToCup = 10000;
|
||||
var distanceFromCup = {size: 500, towards: true};
|
||||
var firstAnimation = {max: 241, min: 171, percent: 1};
|
||||
var secondAnimation = {max: 170, min: 100, percent: 0};
|
||||
var thirdAnimation = {max: 241, min: 100, percent: 0};
|
||||
|
||||
|
||||
|
||||
// ---------------
|
||||
// Box Constructor
|
||||
// ---------------
|
||||
|
||||
function Box(x, y, w, h, options) {
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
this.body = Bodies.rectangle(x, y, w, h, options);
|
||||
|
||||
World.add(world, this.body);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
function calculateLinks() {
|
||||
// 77 is the offset from the bottom and the top
|
||||
// 200 is the amount of space we want between the marshmallow and cup when hanging
|
||||
var spaceLeft = window.innerHeight - (125 + 100 + 77 + 200);
|
||||
var links = spaceLeft / 26;
|
||||
|
||||
if(links < 3) {
|
||||
return Math.ceil(3);
|
||||
} else if(links > 6) {
|
||||
return Math.ceil(6);
|
||||
} else {
|
||||
return Math.ceil(links);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ------------
|
||||
// Create chain
|
||||
// ------------
|
||||
|
||||
function CreateChain(x, y, chainLinks, linkLength) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.hinges = [];
|
||||
this.constraints = [];
|
||||
this.chainLinks = chainLinks;
|
||||
this.linkLength = linkLength;
|
||||
}
|
||||
|
||||
CreateChain.prototype.remove = function() {
|
||||
for(let i = 0; i < this.constraints.length; i++) {
|
||||
World.remove(world, this.constraints[i]);
|
||||
}
|
||||
|
||||
chain = null;
|
||||
};
|
||||
|
||||
CreateChain.prototype.init = function() {
|
||||
// Create hinges
|
||||
for(var i = 0; i < this.chainLinks; i++) {
|
||||
var staticCheck = (i === 0) ? true : false ;
|
||||
|
||||
var anchor = new Box(this.x, this.y + (this.linkLength * i), 5, 5, {
|
||||
isStatic: staticCheck,
|
||||
collisionFilter: {
|
||||
category: 0x0001
|
||||
}
|
||||
});
|
||||
|
||||
this.hinges.push(anchor);
|
||||
}
|
||||
|
||||
// Create links between hinges
|
||||
for(let i = 0; i < this.hinges.length; i++) {
|
||||
var constraint;
|
||||
|
||||
if(i === this.chainLinks - 1) {
|
||||
constraint = Constraint.create({
|
||||
bodyA: this.hinges[i].body,
|
||||
bodyB: marshmallow.body,
|
||||
pointB: { x: 0, y: (marshmallow.h/2 * -1) + 12 },
|
||||
length: this.linkLength,
|
||||
damping: 0.5,
|
||||
stiffness: 0.1,
|
||||
label: 'marshmallowAttachment'
|
||||
});
|
||||
} else {
|
||||
constraint = Constraint.create({
|
||||
bodyA: this.hinges[i].body,
|
||||
bodyB: this.hinges[i + 1].body,
|
||||
length: this.linkLength,
|
||||
damping: 0.5,
|
||||
stiffness: 0.1
|
||||
});
|
||||
}
|
||||
|
||||
this.constraints.push(constraint);
|
||||
World.add(world, constraint);
|
||||
}
|
||||
};
|
||||
|
||||
function createChain() {
|
||||
chain = new CreateChain(width/2, 50, calculateLinks(), 10);
|
||||
chain.init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------
|
||||
// Heat particles
|
||||
// --------------
|
||||
|
||||
function HeatParticle(x, y) {
|
||||
this.position = createVector(x, y);
|
||||
this.index = 0;
|
||||
}
|
||||
|
||||
HeatParticle.prototype.render = function() {
|
||||
push();
|
||||
noStroke();
|
||||
fill('#f0d38d');
|
||||
ellipse(this.position.x, this.position.y, this.parent.particleSize);
|
||||
pop();
|
||||
};
|
||||
|
||||
HeatParticle.prototype.updatePos = function() {
|
||||
this.position.y -= 0.5;
|
||||
this.position.x = Math.sin((frameCount + this.index/0.4) / 35) * 10 + this.parent.position.x;
|
||||
};
|
||||
|
||||
HeatParticle.prototype.checkPos = function() {
|
||||
if(this.position.y < this.parent.position.y - this.parent.height) {
|
||||
this.reset();
|
||||
}
|
||||
};
|
||||
|
||||
HeatParticle.prototype.reset = function() {
|
||||
this.parent.particleIndex += 1;
|
||||
this.index = this.parent.particleIndex;
|
||||
this.position.y = this.parent.position.y;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ----------
|
||||
// Heat lines
|
||||
// ----------
|
||||
|
||||
function HeatLine(x, y, height, particleSize) {
|
||||
this.position = createVector(x, y);
|
||||
this.particles = [];
|
||||
this.particleIndex = 0;
|
||||
this.height = height;
|
||||
this.particleSize = particleSize;
|
||||
}
|
||||
|
||||
HeatLine.prototype.render = function() {
|
||||
for(var i = 0; i < this.particles.length; i++) {
|
||||
this.particles[i].updatePos();
|
||||
this.particles[i].render();
|
||||
this.particles[i].checkPos();
|
||||
}
|
||||
};
|
||||
|
||||
HeatLine.prototype.init = function() {
|
||||
var particleCount = this.height / (this.particleSize / 6);
|
||||
|
||||
for(var i = 0; i < particleCount; i++) {
|
||||
this.particleIndex += 1;
|
||||
|
||||
var particle = new HeatParticle(this.position.x, this.position.y + (i * this.particleSize / 6));
|
||||
particle.index = this.particleIndex;
|
||||
particle.parent = this;
|
||||
|
||||
this.particles.push(particle);
|
||||
}
|
||||
};
|
||||
|
||||
function populateHeatLines() {
|
||||
heatLines.push(new HeatLine(cup.body.position.x, cup.body.position.y - cup.h/2, 50, 5));
|
||||
heatLines.push(new HeatLine(cup.body.position.x - 60, cup.body.position.y - cup.h/2, 50, 5));
|
||||
heatLines.push(new HeatLine(cup.body.position.x + 60, cup.body.position.y - cup.h/2, 50, 5));
|
||||
|
||||
for(var i = 0; i < heatLines.length; i++) {
|
||||
heatLines[i].init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -----------
|
||||
// Cup + Floor
|
||||
// -----------
|
||||
// Change this to an object since we don't need it to construct anything
|
||||
|
||||
function CupFloor() {}
|
||||
|
||||
CupFloor.prototype.destroy = function() {
|
||||
World.remove(world, [
|
||||
floor.body,
|
||||
cup.body,
|
||||
cupLeft.body,
|
||||
cupRight.body,
|
||||
cupHandle.body,
|
||||
]);
|
||||
|
||||
floor = null;
|
||||
cup = null;
|
||||
cupLeft = null;
|
||||
cupRight = null;
|
||||
cupHandle = null;
|
||||
};
|
||||
|
||||
CupFloor.prototype.init = function() {
|
||||
// All of the magic numbers here are to position the elements relative to the marshmallow body
|
||||
floor = new Box(width/2, height - 31.75, 320, 3.5, {isStatic: true, collisionFilter: {category: 0x0002}});
|
||||
cup = new Box(width/2, height - 93, 259, 125.5, {isStatic: true, isSensor: true, label: 'cup', collisionFilter: {category: 0x0002}});
|
||||
cupLeft = new Box(width/2 - 134.5, height - 93, 10, 125.5, {isStatic: true, collisionFilter: {category: 0x0002}});
|
||||
cupRight = new Box(width/2 + 134.5, height - 93, 10, 125.5, {isStatic: true, collisionFilter: {category: 0x0002}});
|
||||
cupHandle = new Box(width/2 + 153, height - 114, 31, 60.5, {isStatic: true, collisionFilter: {category: 0x0002}});
|
||||
};
|
||||
|
||||
var cupFloor = new CupFloor();
|
||||
|
||||
|
||||
|
||||
// ---------
|
||||
// P5 Resize
|
||||
// ---------
|
||||
|
||||
function windowResized() {
|
||||
resizeCanvas(windowWidth, windowHeight);
|
||||
|
||||
cupFloor.destroy();
|
||||
cupFloor.init();
|
||||
|
||||
heatLines = [];
|
||||
populateHeatLines();
|
||||
|
||||
marshmallow.body.isStatic = true;
|
||||
marshmallow.body.angle = 0;
|
||||
|
||||
if(chain) {
|
||||
chain.remove();
|
||||
}
|
||||
createChain();
|
||||
|
||||
marshmallow.body.isStatic = false;
|
||||
|
||||
Body.setVelocity(marshmallow.body, {
|
||||
x: 0,
|
||||
y: 0
|
||||
});
|
||||
|
||||
marshmallow.angularVelocity = 0;
|
||||
marshmallow.angularSpeed = 0;
|
||||
|
||||
firstAnimation.percent = 0;
|
||||
secondAnimation.percent = 0;
|
||||
thirdAnimation.percent = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------
|
||||
// P5 Setup
|
||||
// --------
|
||||
|
||||
function setup() {
|
||||
|
||||
// Setup the canvas
|
||||
var canvas = createCanvas(windowWidth, windowHeight);
|
||||
rectMode(CENTER);
|
||||
|
||||
// Setup the mouse events
|
||||
var mouse = Mouse.create(canvas.elt);
|
||||
mouse.pixelRatio = pixelDensity();
|
||||
|
||||
var mouseConstraint = MouseConstraint.create(engine, {mouse: mouse, constraint: {stiffness: 0.2}});
|
||||
mouseConstraint.collisionFilter.category = 0x0002;
|
||||
|
||||
World.add(world, mouseConstraint);
|
||||
|
||||
// Load all of the image assets
|
||||
marshmallowBody = loadImage('https://s3-us-west-2.amazonaws.com/s.cdpn.io/49240/body.png');
|
||||
floorImg = loadImage('https://s3-us-west-2.amazonaws.com/s.cdpn.io/49240/ground.png');
|
||||
cupImg = loadImage('https://s3-us-west-2.amazonaws.com/s.cdpn.io/49240/cup.png');
|
||||
cupHandleImg = loadImage('https://s3-us-west-2.amazonaws.com/s.cdpn.io/49240/cupHandle.png');
|
||||
|
||||
// Create the boundaries
|
||||
cupFloor.init();
|
||||
|
||||
|
||||
// -----------
|
||||
// Marshmallow
|
||||
// -----------
|
||||
// The marshmallow code below is very messy and should be refactored into a constructor
|
||||
|
||||
marshmallow = new Box(width/2, 0, 80, 100, {
|
||||
density: 0.00001,
|
||||
label: 'marshmallow',
|
||||
collisionFilter: {
|
||||
category: 0x0001,
|
||||
mask: 0x0002
|
||||
}
|
||||
});
|
||||
|
||||
createChain();
|
||||
|
||||
armLeft = Bodies.circle(width/2 - 40, 300, 5, {
|
||||
collisionFilter: {
|
||||
category: 0x0001
|
||||
},
|
||||
density: 0.00001
|
||||
});
|
||||
|
||||
armRight = Bodies.circle(width/2 + 40, 300, 5, {
|
||||
collisionFilter: {
|
||||
category: 0x0001
|
||||
},
|
||||
density: 0.00001
|
||||
});
|
||||
|
||||
var legRight = Bodies.circle(width/2 + 20, 300 + 50, 0.1, {
|
||||
collisionFilter: {
|
||||
category: 0x0001
|
||||
},
|
||||
density: 0.00001
|
||||
});
|
||||
|
||||
var legLeft = Bodies.circle(width/2 - 20, 300 + 50, 0.1, {
|
||||
collisionFilter: {
|
||||
category: 0x0001
|
||||
},
|
||||
density: 0.00001
|
||||
});
|
||||
|
||||
constraintArmLeft = Constraint.create({
|
||||
bodyA: marshmallow.body,
|
||||
bodyB: armLeft,
|
||||
pointA: { x: -39, y: -20 },
|
||||
length: 40,
|
||||
damping: 0.5,
|
||||
stiffness: 1,
|
||||
label: 'limb'
|
||||
});
|
||||
|
||||
constraintArmRight = Constraint.create({
|
||||
bodyA: marshmallow.body,
|
||||
bodyB: armRight,
|
||||
pointA: { x: 39, y: -20 },
|
||||
length: 40,
|
||||
damping: 0.5,
|
||||
stiffness: 1,
|
||||
label: 'limb'
|
||||
});
|
||||
|
||||
constraintLegRight = Constraint.create({
|
||||
bodyA: marshmallow.body,
|
||||
bodyB: legRight,
|
||||
pointA: { x: 20, y: 49 },
|
||||
length: 30,
|
||||
damping: 0.5,
|
||||
stiffness: 1,
|
||||
label: 'limb'
|
||||
});
|
||||
|
||||
constraintLegLeft = Constraint.create({
|
||||
bodyA: marshmallow.body,
|
||||
bodyB: legLeft,
|
||||
pointA: { x: -20, y: 49 },
|
||||
length: 30,
|
||||
damping: 0.5,
|
||||
stiffness: 1,
|
||||
label: 'limb'
|
||||
});
|
||||
|
||||
World.add(world, [
|
||||
armLeft,
|
||||
armRight,
|
||||
legRight,
|
||||
legLeft,
|
||||
constraintArmLeft,
|
||||
constraintArmRight,
|
||||
constraintLegRight,
|
||||
constraintLegLeft
|
||||
]);
|
||||
|
||||
// Create and initialize the heat lines
|
||||
populateHeatLines();
|
||||
|
||||
// Start the engine
|
||||
Engine.run(engine);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------
|
||||
// P5 Draw
|
||||
// -------
|
||||
|
||||
function draw() {
|
||||
clear();
|
||||
|
||||
// ----------------------
|
||||
// Outline matter objects
|
||||
// ----------------------
|
||||
|
||||
// push();
|
||||
// var bodies = Composite.allBodies(engine.world);
|
||||
//
|
||||
// drawingContext.beginPath();
|
||||
// for (var i = 0; i < bodies.length; i += 1) {
|
||||
// var vertices = bodies[i].vertices;
|
||||
// drawingContext.moveTo(vertices[0].x, vertices[0].y);
|
||||
// for (var j = 1; j < vertices.length; j += 1) {
|
||||
// drawingContext.lineTo(vertices[j].x, vertices[j].y);
|
||||
// }
|
||||
// drawingContext.lineTo(vertices[0].x, vertices[0].y);
|
||||
// }
|
||||
//
|
||||
// drawingContext.lineWidth = 1;
|
||||
// drawingContext.strokeStyle = '#9e9e9e';
|
||||
// drawingContext.stroke();
|
||||
// pop();
|
||||
|
||||
|
||||
if(cup) {
|
||||
// heatLines
|
||||
for(var i = 0; i < heatLines.length; i++) {
|
||||
heatLines[i].render();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --------------------
|
||||
// Draw the marshmallow
|
||||
// --------------------
|
||||
|
||||
push();
|
||||
translate(marshmallow.body.position.x, marshmallow.body.position.y);
|
||||
rotate(marshmallow.body.angle);
|
||||
image(marshmallowBody, marshmallow.w/2 * -1, marshmallow.h/2 * -1, marshmallow.w, marshmallow.h);
|
||||
pop();
|
||||
|
||||
|
||||
|
||||
// --------------
|
||||
// Draw the chain
|
||||
// --------------
|
||||
|
||||
var allConstraints = Composite.allConstraints(engine.world);
|
||||
var marshmallowAttachment;
|
||||
|
||||
// Rope hole at the top of the page
|
||||
if(chain) {
|
||||
push();
|
||||
noStroke();
|
||||
fill('black');
|
||||
ellipse(chain.x, chain.y, 25, 6);
|
||||
pop();
|
||||
}
|
||||
|
||||
for(let i = 0; i < allConstraints.length; i++) {
|
||||
if(allConstraints[i].label === 'marshmallowAttachment') {
|
||||
marshmallowAttachment = allConstraints[i];
|
||||
}
|
||||
|
||||
if(allConstraints[i].label !== 'Mouse Constraint') {
|
||||
push();
|
||||
strokeWeight(2.5);
|
||||
|
||||
line(
|
||||
allConstraints[i].bodyA.position.x + allConstraints[i].pointA.x,
|
||||
allConstraints[i].bodyA.position.y + allConstraints[i].pointA.y,
|
||||
allConstraints[i].bodyB.position.x + allConstraints[i].pointB.x,
|
||||
allConstraints[i].bodyB.position.y + allConstraints[i].pointB.y
|
||||
);
|
||||
pop();
|
||||
}
|
||||
}
|
||||
|
||||
// Rope attachment on top of head
|
||||
if(marshmallowAttachment) {
|
||||
push();
|
||||
noStroke();
|
||||
fill('black');
|
||||
translate(marshmallowAttachment.bodyB.position.x + marshmallowAttachment.pointB.x, marshmallowAttachment.bodyB.position.y + marshmallowAttachment.pointB.y);
|
||||
rotate(marshmallow.body.angle);
|
||||
ellipse(0, 0, 10, 3);
|
||||
pop();
|
||||
}
|
||||
|
||||
// Draw arms
|
||||
push();
|
||||
strokeWeight(2.5);
|
||||
ellipse(armLeft.position.x, armLeft.position.y, 10);
|
||||
ellipse(armRight.position.x, armRight.position.y, 10);
|
||||
pop();
|
||||
|
||||
// When the arms enter the cup, raise them
|
||||
if(cup) {
|
||||
if(marshmallow.body.position.y / height > 0.75 && marshmallow.body.position.x > cup.body.position.x - cup.w/2 && marshmallow.body.position.x < cup.body.position.x + cup.w/2) {
|
||||
Matter.Body.setVelocity(armLeft, { x: 0, y: -3 });
|
||||
Matter.Body.setVelocity(armRight, { x: 0, y: -3 });
|
||||
}
|
||||
}
|
||||
|
||||
// Facial expression
|
||||
|
||||
if(cup) {
|
||||
distanceToCup = Math.sqrt(Math.pow(marshmallow.body.position.x - cup.body.position.x, 2) + Math.pow(marshmallow.body.position.y - cup.body.position.y, 2));
|
||||
} else {
|
||||
distanceToCup = 1000;
|
||||
}
|
||||
|
||||
if(distanceToCup <= firstAnimation.max && distanceToCup >= firstAnimation.min) {
|
||||
firstAnimation.percent = (distanceToCup - firstAnimation.min) / (firstAnimation.max - firstAnimation.min);
|
||||
}
|
||||
|
||||
if(distanceToCup < secondAnimation.max && distanceToCup >= secondAnimation.min) {
|
||||
secondAnimation.percent = ((distanceToCup - secondAnimation.min) / (secondAnimation.max - secondAnimation.min) - 1) * -1;
|
||||
}
|
||||
|
||||
if(distanceToCup < thirdAnimation.max && distanceToCup >= thirdAnimation.min) {
|
||||
thirdAnimation.percent = ((distanceToCup - thirdAnimation.min) / (thirdAnimation.max - thirdAnimation.min) - 1) * -1;
|
||||
}
|
||||
|
||||
if(distanceToCup < secondAnimation.max) {
|
||||
firstAnimation.percent = 0;
|
||||
}
|
||||
|
||||
if(distanceToCup > firstAnimation.max) {
|
||||
firstAnimation.percent = 1;
|
||||
secondAnimation.percent = 0;
|
||||
}
|
||||
|
||||
// Marshmallow eye left
|
||||
push();
|
||||
translate(marshmallow.body.position.x, marshmallow.body.position.y);
|
||||
strokeWeight(3);
|
||||
noFill();
|
||||
rotate(marshmallow.body.angle);
|
||||
bezier(
|
||||
-20, -5 + (secondAnimation.percent * 5) + (secondAnimation.percent * -4),
|
||||
-20, -5 + (firstAnimation.percent * -7) + (secondAnimation.percent * 5) + (secondAnimation.percent * -4),
|
||||
-10, -5 + (firstAnimation.percent * -7) + (secondAnimation.percent * -4),
|
||||
-10, -5 + (secondAnimation.percent * -4)
|
||||
);
|
||||
pop();
|
||||
|
||||
// Marshmallow eye right
|
||||
// The second parameter, (secondAnimation.percent * -4), is to move the item up when the animation happens
|
||||
push();
|
||||
translate(marshmallow.body.position.x, marshmallow.body.position.y);
|
||||
strokeWeight(3);
|
||||
noFill();
|
||||
rotate(marshmallow.body.angle);
|
||||
bezier(
|
||||
20, -5 + (secondAnimation.percent * 5) + (secondAnimation.percent * -4),
|
||||
20, -5 + (firstAnimation.percent * -7) + (secondAnimation.percent * 5) + (secondAnimation.percent * -4),
|
||||
10, -5 + (firstAnimation.percent * -7) + (secondAnimation.percent * -4),
|
||||
10, -5 + (secondAnimation.percent * -4)
|
||||
);
|
||||
pop();
|
||||
|
||||
// Marshmallow mouth
|
||||
push();
|
||||
stroke('#000');
|
||||
strokeJoin(ROUND);
|
||||
strokeWeight(2);
|
||||
fill('black');
|
||||
translate(marshmallow.body.position.x, marshmallow.body.position.y);
|
||||
rotate(marshmallow.body.angle);
|
||||
arc(0, 12 + (thirdAnimation.percent * 5), 16, firstAnimation.percent * 14, 0, 3.14, CHORD);
|
||||
arc(0, 12 + (thirdAnimation.percent * 5), 16, thirdAnimation.percent * 14, 3.14, 0, CHORD);
|
||||
pop();
|
||||
|
||||
|
||||
|
||||
// ---
|
||||
// Cup
|
||||
// ---
|
||||
|
||||
if(cup) {
|
||||
push();
|
||||
noStroke();
|
||||
fill('#fee096');
|
||||
translate(cup.body.position.x, cup.body.position.y);
|
||||
rect(0, 60, cup.w + 20, cup.h + 100);
|
||||
pop();
|
||||
|
||||
push();
|
||||
translate(floor.body.position.x, floor.body.position.y);
|
||||
image(floorImg, floor.w/2 * -1, floor.h/2 * -1, floor.w, floor.h);
|
||||
pop();
|
||||
|
||||
push();
|
||||
translate(cup.body.position.x, cup.body.position.y);
|
||||
image(cupImg, (cup.w/2 * -1) - 10, cup.h/2 * -1, cup.w + 20, cup.h);
|
||||
pop();
|
||||
|
||||
push();
|
||||
noFill();
|
||||
noStroke();
|
||||
translate(cupHandle.body.position.x, cupHandle.body.position.y);
|
||||
image(cupHandleImg, cupHandle.w/2 * -1, cupHandle.h/2 * -1, cupHandle.w, cupHandle.h);
|
||||
pop();
|
||||
|
||||
// Outer eye Left
|
||||
push();
|
||||
noStroke();
|
||||
fill('white');
|
||||
translate(cup.body.position.x - 76.5, cup.body.position.y - 5.5);
|
||||
ellipse(0, 0, 34);
|
||||
rotate(thirdAnimation.percent * 1.3);
|
||||
stroke('#812d29');
|
||||
strokeWeight(3.5);
|
||||
line(-24, 2, 2, -24);
|
||||
pop();
|
||||
|
||||
// Outer eye right
|
||||
push();
|
||||
noStroke();
|
||||
fill('white');
|
||||
translate(cup.body.position.x + 76.5, cup.body.position.y - 5.5);
|
||||
ellipse(0, 0, 34);
|
||||
rotate(thirdAnimation.percent * -1.3);
|
||||
stroke('#812d29');
|
||||
strokeWeight(3.5);
|
||||
line(24, -2, -2, -24);
|
||||
pop();
|
||||
|
||||
// Cheek right
|
||||
push();
|
||||
noStroke();
|
||||
fill('#f6554f');
|
||||
translate(cup.body.position.x + 76.5, cup.body.position.y);
|
||||
ellipse(0, 10 + thirdAnimation.percent * 3, 34, 10);
|
||||
pop();
|
||||
|
||||
// Cheek left
|
||||
push();
|
||||
noStroke();
|
||||
fill('#ff635b');
|
||||
translate(cup.body.position.x - 76.5, cup.body.position.y);
|
||||
ellipse(0, 10 + thirdAnimation.percent * 3, 34, 10);
|
||||
pop();
|
||||
|
||||
// Blush left
|
||||
push();
|
||||
noStroke();
|
||||
fill('#ff847e');
|
||||
translate(cup.body.position.x - 76.5, cup.body.position.y);
|
||||
ellipse(-20, 18.5, 18.5, 11);
|
||||
pop();
|
||||
|
||||
// Blush right
|
||||
push();
|
||||
noStroke();
|
||||
fill('#ff635b');
|
||||
translate(cup.body.position.x + 76.5, cup.body.position.y);
|
||||
ellipse(20, 18.5, 18.5, 11);
|
||||
pop();
|
||||
|
||||
// Inner eyes
|
||||
push();
|
||||
noStroke();
|
||||
fill('black');
|
||||
translate(cup.body.position.x, cup.body.position.y);
|
||||
ellipse(
|
||||
-76.5 + (marshmallow.body.position.x / width - 0.5) * 10,
|
||||
-7 + (marshmallow.body.position.y / height - 0.5) * 10,
|
||||
9.5
|
||||
);
|
||||
ellipse(
|
||||
76.5 + (marshmallow.body.position.x / width - 0.5) * 10,
|
||||
-7 + (marshmallow.body.position.y / height - 0.5) * 10,
|
||||
9.5
|
||||
);
|
||||
pop();
|
||||
|
||||
// Cup mouth
|
||||
push();
|
||||
stroke('#812d29');
|
||||
strokeJoin(ROUND);
|
||||
strokeWeight(2);
|
||||
fill('#812d29');
|
||||
translate(cup.body.position.x, cup.body.position.y);
|
||||
rotate(cup.body.angle);
|
||||
arc(0, -10 + (thirdAnimation.percent * 18), 46, firstAnimation.percent * 44, 0, 3.14, CHORD);
|
||||
arc(0, -10 + (thirdAnimation.percent * 18), 46, thirdAnimation.percent * 44, 3.14, 0, CHORD);
|
||||
pop();
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,28 @@
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
|
||||
<%
|
||||
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 'LostAndFound.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,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?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.Userinfo" table="userinfo" catalog="postgres">
|
||||
<id name="id" type="java.lang.Integer">
|
||||
<column name="id" />
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
<property name="username" type="java.lang.String">
|
||||
<column name="username" length="45" />
|
||||
</property>
|
||||
<property name="password" type="java.lang.String">
|
||||
<column name="password" length="45" not-null="true" />
|
||||
</property>
|
||||
<property name="age" type="java.lang.Integer">
|
||||
<column name="age" />
|
||||
</property>
|
||||
<property name="email" type="java.lang.String">
|
||||
<column name="email" length="45" unique="true" />
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
@ -0,0 +1,38 @@
|
||||
<?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.Xz" table="xz" 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" not-null="true" />
|
||||
</property>
|
||||
<property name="desc" type="java.lang.String">
|
||||
<column name="desc" length="45" />
|
||||
</property>
|
||||
<property name="sep" type="java.lang.Integer">
|
||||
<column name="sep" not-null="true" />
|
||||
</property>
|
||||
<property name="orp" type="java.lang.Integer">
|
||||
<column name="orp" />
|
||||
</property>
|
||||
<property name="postage" type="java.lang.String">
|
||||
<column name="postage" length="45" />
|
||||
</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,30 @@
|
||||
<?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/postgres
|
||||
</property>
|
||||
<property name="connection.username">root</property>
|
||||
<property name="connection.password">3141592653</property>
|
||||
<property name="connection.driver_class">
|
||||
com.mysql.jdbc.Driver
|
||||
</property>
|
||||
<property name="myeclipse.connection.profile">
|
||||
postgres
|
||||
</property>
|
||||
<property name="connection.autocommit">true</property>
|
||||
<mapping resource="com/Userinfo.hbm.xml" />
|
||||
<mapping resource="com/Xz.hbm.xml" />
|
||||
|
||||
</session-factory>
|
||||
|
||||
</hibernate-configuration>
|
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
|
||||
<struts>
|
||||
<constant name="struts.devMode" value="false" />
|
||||
<package name="basicstruts2" extends="struts-default">
|
||||
|
||||
<action name="registerInput">
|
||||
<result>/register.jsp</result></action>
|
||||
|
||||
<action name="loginInput">
|
||||
<result>/login.jsp</result></action>
|
||||
|
||||
<action name="Register" class="RegisterAction" method="register">
|
||||
<result name="success">/success.jsp</result>
|
||||
<result name="error">/error.jsp</result></action>
|
||||
|
||||
|
||||
<action name="Login" class="RegisterAction" method="login">
|
||||
<result name="success">/welcome.jsp</result>
|
||||
<result name="error">/success.jsp</result></action>
|
||||
|
||||
<action name="Fbxz" class="SubmitXzAction" method="submit">
|
||||
<result name="success">/welcome.jsp</result>
|
||||
<result name="error">/success.jsp</result></action>
|
||||
|
||||
|
||||
</package>
|
||||
|
||||
</struts>
|
@ -0,0 +1,20 @@
|
||||
<?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>
|
||||
<filter>
|
||||
<filter-name>struts2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
|
||||
</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>struts2</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping></web-app>
|
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 207 KiB |
After Width: | Height: | Size: 872 KiB |
After Width: | Height: | Size: 259 KiB |
After Width: | Height: | Size: 468 KiB |
After Width: | Height: | Size: 481 KiB |
After Width: | Height: | Size: 483 KiB |
After Width: | Height: | Size: 5.1 MiB |
After Width: | Height: | Size: 712 KiB |
After Width: | Height: | Size: 128 KiB |
@ -0,0 +1,18 @@
|
||||
<%@ 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>
|
@ -0,0 +1,16 @@
|
||||
<%@ 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,28 @@
|
||||
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
|
||||
<%
|
||||
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 'market.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,18 @@
|
||||
<%@ 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,9 @@
|
||||
<%@ 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>
|
@ -0,0 +1,7 @@
|
||||
<%@ 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>
|
@ -0,0 +1,70 @@
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToOne;
|
||||
import org.hibernate.Transaction;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.Session;
|
||||
import com.HibernateSessionFactory;
|
||||
import com.Userinfo;
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
|
||||
|
||||
@Entity
|
||||
public class RegisterAction extends ActionSupport {
|
||||
@ManyToOne
|
||||
private Userinfo user;
|
||||
|
||||
public Userinfo getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(Userinfo user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String execute() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return SUCCESS;
|
||||
}
|
||||
public String register() throws Exception{
|
||||
try{
|
||||
Session session=HibernateSessionFactory.getSession();
|
||||
Transaction tx=session.beginTransaction();
|
||||
session.save(user);
|
||||
tx.commit();
|
||||
return SUCCESS;
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
HibernateSessionFactory.getSession().close();
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
public String login() throws Exception{
|
||||
try{
|
||||
Session session=HibernateSessionFactory.getSession();
|
||||
Transaction tx=session.beginTransaction();
|
||||
// Query query=session.createQuery("from Userinfo where username=:uname");
|
||||
Query query = session.createQuery("from Userinfo where username=:uname and password=:upassword");
|
||||
query.setParameter("uname", user.getUsername());
|
||||
query.setParameter("upassword", user.getPassword());
|
||||
List list=query.list();
|
||||
|
||||
tx.commit();
|
||||
|
||||
if(list.size()>0){
|
||||
return SUCCESS;
|
||||
}else
|
||||
return ERROR;
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
HibernateSessionFactory.getSession().close();
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import com.Xz;
|
||||
import com.HibernateSessionFactory;
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
|
||||
|
||||
public class SubmitXzAction extends ActionSupport {
|
||||
|
||||
private Xz xz;
|
||||
|
||||
public Xz getXz() {
|
||||
return xz;
|
||||
}
|
||||
|
||||
public void setXz(Xz xz) {
|
||||
this.xz = xz;
|
||||
}
|
||||
|
||||
@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(xz);
|
||||
tx.commit();
|
||||
return SUCCESS;
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
HibernateSessionFactory.getSession().close();
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com;
|
||||
|
||||
/**
|
||||
* AbstractUserinfo entity provides the base persistence definition of the
|
||||
* Userinfo entity. @author MyEclipse Persistence Tools
|
||||
*/
|
||||
|
||||
public abstract class AbstractUserinfo implements java.io.Serializable {
|
||||
|
||||
// Fields
|
||||
|
||||
private Integer id;
|
||||
private String username;
|
||||
private String password;
|
||||
private Integer age;
|
||||
private String email;
|
||||
|
||||
// Constructors
|
||||
|
||||
/** default constructor */
|
||||
public AbstractUserinfo() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public AbstractUserinfo(Integer id, String password) {
|
||||
this.id = id;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/** full constructor */
|
||||
/*public AbstractUserinfo(Integer id, String username, String password,
|
||||
Integer age, String email) {
|
||||
this.id = id;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.age = age;
|
||||
this.email = email;
|
||||
}*/
|
||||
public AbstractUserinfo( String username, String password,
|
||||
Integer age, String email) {
|
||||
//this.id = id;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.age = age;
|
||||
this.email = email;
|
||||
}
|
||||
// Property accessors
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
System.out.println(this.username);
|
||||
return this.username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
System.out.println(this.password);
|
||||
return this.password;
|
||||
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Integer getAge() {
|
||||
return this.age;
|
||||
}
|
||||
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package com;
|
||||
|
||||
/**
|
||||
* AbstractXz entity provides the base persistence definition of the Xz entity. @author
|
||||
* MyEclipse Persistence Tools
|
||||
*/
|
||||
|
||||
public abstract class AbstractXz implements java.io.Serializable {
|
||||
|
||||
// Fields
|
||||
|
||||
// private Integer id;
|
||||
private String title;
|
||||
private String desc;
|
||||
private Integer sep;
|
||||
private Integer orp;
|
||||
private String postage;
|
||||
private String wx;
|
||||
private String tel;
|
||||
private String qq;
|
||||
|
||||
// Constructors
|
||||
|
||||
/** default constructor */
|
||||
public AbstractXz() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public AbstractXz(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) {
|
||||
this.title = title;
|
||||
this.desc = desc;
|
||||
this.sep = sep;
|
||||
this.orp = orp;
|
||||
this.postage = postage;
|
||||
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 getDesc() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getSep() {
|
||||
return this.sep;
|
||||
}
|
||||
|
||||
public void setSep(Integer sep) {
|
||||
this.sep = sep;
|
||||
}
|
||||
|
||||
public Integer getOrp() {
|
||||
return this.orp;
|
||||
}
|
||||
|
||||
public void setOrp(Integer orp) {
|
||||
this.orp = orp;
|
||||
}
|
||||
|
||||
public String getPostage() {
|
||||
return this.postage;
|
||||
}
|
||||
|
||||
public void setPostage(String postage) {
|
||||
this.postage = postage;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
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 }.
|
||||
*/
|
||||
@Entity
|
||||
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,26 @@
|
||||
<?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.Userinfo" table="userinfo" catalog="postgres">
|
||||
<id name="id" type="java.lang.Integer">
|
||||
<column name="id" />
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
<property name="username" type="java.lang.String">
|
||||
<column name="username" length="45" />
|
||||
</property>
|
||||
<property name="password" type="java.lang.String">
|
||||
<column name="password" length="45" not-null="true" />
|
||||
</property>
|
||||
<property name="age" type="java.lang.Integer">
|
||||
<column name="age" />
|
||||
</property>
|
||||
<property name="email" type="java.lang.String">
|
||||
<column name="email" length="45" unique="true" />
|
||||
</property>
|
||||
</class>
|
||||
</hibernate-mapping>
|
@ -0,0 +1,33 @@
|
||||
package com;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Userinfo entity. @author MyEclipse Persistence Tools
|
||||
*/
|
||||
@Entity
|
||||
public class Userinfo extends AbstractUserinfo implements java.io.Serializable {
|
||||
|
||||
// Constructors
|
||||
|
||||
/** default constructor */
|
||||
public Userinfo() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public Userinfo(Integer id, String password) {
|
||||
super(id, password);
|
||||
}
|
||||
|
||||
/** full constructor */
|
||||
/* public Userinfo(Integer id, String username, String password, Integer age,
|
||||
String email) {
|
||||
super(id, username, password, age, email);
|
||||
}*/
|
||||
public Userinfo( String username, String password, Integer age,
|
||||
String email) {
|
||||
super(username, password, age, email);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?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.Xz" table="xz" 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" not-null="true" />
|
||||
</property>
|
||||
<property name="desc" type="java.lang.String">
|
||||
<column name="desc" length="45" />
|
||||
</property>
|
||||
<property name="sep" type="java.lang.Integer">
|
||||
<column name="sep" not-null="true" />
|
||||
</property>
|
||||
<property name="orp" type="java.lang.Integer">
|
||||
<column name="orp" />
|
||||
</property>
|
||||
<property name="postage" type="java.lang.String">
|
||||
<column name="postage" length="45" />
|
||||
</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,25 @@
|
||||
package com;
|
||||
|
||||
/**
|
||||
* Xz entity. @author MyEclipse Persistence Tools
|
||||
*/
|
||||
public class Xz extends AbstractXz implements java.io.Serializable {
|
||||
|
||||
// Constructors
|
||||
|
||||
/** default constructor */
|
||||
public Xz() {
|
||||
}
|
||||
|
||||
/** minimal constructor */
|
||||
public Xz( String title, Integer sep) {
|
||||
super(title, sep);
|
||||
}
|
||||
|
||||
/** full constructor */
|
||||
public Xz(String title, String desc, Integer sep, Integer orp,
|
||||
String postage, String wx, String tel, String qq) {
|
||||
super(title, desc, sep, orp, postage, wx, tel, qq);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?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/postgres
|
||||
</property>
|
||||
<property name="connection.username">root</property>
|
||||
<property name="connection.password">3141592653</property>
|
||||
<property name="connection.driver_class">
|
||||
com.mysql.jdbc.Driver
|
||||
</property>
|
||||
<property name="myeclipse.connection.profile">
|
||||
postgres
|
||||
</property>
|
||||
<property name="connection.autocommit">true</property>
|
||||
<mapping resource="com/Userinfo.hbm.xml" />
|
||||
<mapping resource="com/Xz.hbm.xml" />
|
||||
|
||||
</session-factory>
|
||||
|
||||
</hibernate-configuration>
|
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
|
||||
<struts>
|
||||
<constant name="struts.devMode" value="false" />
|
||||
<package name="basicstruts2" extends="struts-default">
|
||||
|
||||
<action name="registerInput">
|
||||
<result>/register.jsp</result></action>
|
||||
|
||||
<action name="loginInput">
|
||||
<result>/login.jsp</result></action>
|
||||
|
||||
<action name="Register" class="RegisterAction" method="register">
|
||||
<result name="success">/success.jsp</result>
|
||||
<result name="error">/error.jsp</result></action>
|
||||
|
||||
|
||||
<action name="Login" class="RegisterAction" method="login">
|
||||
<result name="success">/welcome.jsp</result>
|
||||
<result name="error">/success.jsp</result></action>
|
||||
|
||||
<action name="Fbxz" class="SubmitXzAction" method="submit">
|
||||
<result name="success">/welcome.jsp</result>
|
||||
<result name="error">/success.jsp</result></action>
|
||||
|
||||
|
||||
</package>
|
||||
|
||||
</struts>
|