05 昨天主要作了登錄頁面的任務,今天要作登錄用戶的一些條件註冊。css
下面是主要的一些代碼:html
<%@ 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>登錄處理</title>
</head>
<body>
<%
String useid=request.getParameter("useid");
String usepass=request.getParameter("usepass");
if(useid==null||useid.trim().length()==0)
{
response.sendRedirect("fauile.jsp?mes=1");}java
else if(usepass==null||usepass.trim().length()==0)
{
response.sendRedirect("fauile.jsp?mes=2");
}
else
{
Object o=application.getAttribute(useid); sql
if(o==null)
{
response.sendRedirect("fauile.jsp?mes=6");
}
else
{
String inich=o.toString().split("#")[1];
String ipassw=o.toString().split("#")[2];
if(ipassw.trim().equals(usepass.trim()))
{
String zhnice=new String(inich.getBytes("iso-8859-1"),"utf-8") ;
out.println("歡迎"+zhnice+"登錄!"+"<a herf='success.jsp'>");
session.setAttribute("user", zhnice);
}數據庫
else
{
response.sendRedirect("fauile.jsp?mes=7");
}session
}app
}jsp
%>
</body>
</html>sqlserver
06post
昨天主要作了登錄頁面的一些條件,今天要作主頁
下面是一些代碼
<%@ 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 action="chazhao.jsp" method="post">
登錄成功頁面
請輸入你要查詢的專業:
<select name="leixing">
<option value=0>table1</option>
<option value=1>jike</option>
</select>
<input type="submit" name="submit" value="查找">
<form action="xianshijieguo.jsp"method="post"></form>
<textarea name="content" cols="30" row="5"></textarea>
<br>
<input type="submit" name="Button" value="發佈">
</form>
<br>
<br>
<br>
</body>
</html>
07 昨天主要作了主頁的內容,今天要作查找的內容,主要是從數據中查找,下面是主要的帶代碼
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<!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>
<style type="text/css">
table {
border-collapse: collapse;
border: none;
margin: 0px auto;
width: 500px;
}
th, td {
border: solid #333 1px;
height: 20px;
}
div {
text-align: center;
}
</style>
<table>
<tr>
<th>生日</th>
<th>電話</th>
<th>電子郵件</th>
<th>地區</th>
</tr>
<%
String leixing=request.getParameter("leixing");
if(Integer.parseInt(leixing)==0)
{
Statement sql;
request.setCharacterEncoding("UTF-8");
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url="jdbc:sqlserver://localhost:1433; DatabaseName=model";
String username="sa";
String password="19941103lipeng";
Connection conn=DriverManager.getConnection(url, username, password);
String information="select *from table1";
sql=conn.createStatement();
ResultSet rs = sql.executeQuery(information);
while (rs.next())
{
out.println("<tr><td>" + rs.getString(3)+
"</td><td>" + rs.getString(4) +
"</td><td>" + rs.getString(5)+
"</td><td>" + rs.getString(6)
+ "</td></tr>");
}
rs.close();
sql.close();
conn.close();
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
}
%>
</table>
</body>
</html>
08 昨天主要作了查找的內容,今天要作的是發佈項目的實現
下面是主要的代碼
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<!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>
<%
try{
request.setCharacterEncoding("utf-8");
Statement sql;
String person=request.getParameter("person");
String riqi1=request.getParameter("riqi1");
String riqi2=request.getParameter("riqi2");
String tel=request.getParameter("tel");
String comment=request.getParameter("comment");
String personneed=request.getParameter("personneed");
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url="jdbc:sqlserver://localhost:1433; DatabaseName=master";
String username="sa";
String password="19941103lipeng";
Connection conn=DriverManager.getConnection(url, username, password);
String information="Insert into xiangmu values('"+person+"','"+riqi1+"','"+riqi2+"','"+tel+"','"+comment+"','"+personneed+"')";
sql=conn.createStatement();
sql.execute(information);
sql.close();
conn.close();
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
%>
<center>
<form action="shouye.jsp" method="post">
<input type="submit" name="submit" value="提交成功">
<input type="submit" name="submit" value="返回首頁">
</form>
</center>
</body>
</html>
09 昨天寫了數據庫的查找,今天要寫頁面的一些美化及其項目的發佈頁面
下面主要是一些代碼
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*" %>
<!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>
<style type="text/css">
table {
border-collapse: collapse;
border: none;
margin: 0px auto;
width: 500px;
}
th, td {
border: solid #333 1px;
height: 20px;
}
div {
text-align: center;
}
</style>
</head>
<body>
<table>
<tr>
<th>發佈人</th>
<th>發佈日期</th>
<th>截止日期</th>
<th>聯繫電話</th>
<th>項目內容</th>
<th>所需人員</th>
</tr>
<%
try{
Statement sql;
request.setCharacterEncoding("UTF-8");
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url="jdbc:sqlserver://localhost:1433; DatabaseName=master";
String username="sa";
String password="19941103lipeng";
Connection conn=DriverManager.getConnection(url, username, password);
String information="select *from xiangmu";
sql=conn.createStatement();
ResultSet rs = sql.executeQuery(information);
while (rs.next())
{
out.println("<tr><td>" + rs.getString(1)+
"</td><td>" + rs.getString(2) +
"</td><td>" + rs.getString(3) +
"</td><td>" + rs.getString(4) +
"</td><td>" + rs.getString(5)+
"</td><td>" + rs.getString(6)
+ "</td></tr>");
}
rs.close();
sql.close();
conn.close();
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
%>
</table>
</body>
</html>
10 昨天主要美化了頁面,進天主要修復一些BUG,完成全部的工做