第一个Hibernate 程序

使用MyEclipse建立Hibernate工程

index页面的Jsp源文件

<%@ 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>

login页面

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!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>
用户登陆 
    <form method="post" action="servlet/LoginServlet" >
    用户名:<input type= "text" size="30" name ="userName"  ><br>
    密码:<input  type = "password"  size="30"  name = "userPassword">

  <input type="submit" value="登陆" >
    </form>
</body>
</html>

register页面

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!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> 
用户注册 
    <form method="post" action="servlet/RegistServlet" style= "">
    用户名:<input type= "text" size="30" name ="userName"  ><br>
    密码:<input  type = "password"  size="30"  name = "userPassword"><br>
  E-mail :<input type = "text"  size="30"  name = "userEmail"><br>
  <input type="submit" value="注册" >
    </form>

</body>
</html>

 

posted @ 2013-06-24 15:38  夜雨阑珊  阅读(231)  评论(0编辑  收藏  举报