婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 知識(shí)庫(kù) > 關(guān)于JSP的一點(diǎn)疑問小結(jié)

關(guān)于JSP的一點(diǎn)疑問小結(jié)

熱門標(biāo)簽:湖北地圖標(biāo)注公司 外呼直播語(yǔ)音系統(tǒng) 汝南縣地圖標(biāo)注app 地圖標(biāo)注專業(yè)和非專業(yè) 福建電銷貓機(jī)器人收費(fèi) 四川正規(guī)外呼系統(tǒng)軟件 山東ai外呼電銷機(jī)器人好用嗎 甘肅銷售電銷機(jī)器人公司 智能電話機(jī)器人銷售話術(shù)
希望誰(shuí)能幫我看一看問題出在哪?謝謝!
register.html部分:
復(fù)制代碼 代碼如下:

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
html>
head>
title>register.html/title>
meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
meta http-equiv="description" content="this is my page">
meta http-equiv="content-type" content="text/html; charset=UTF-8">
!--link rel="stylesheet" type="text/css" href="./styles.css">-->
/head>
body>
br>
form action="register.jsp" method = "Post" name = "frm">
用戶名:input type = "text" name = "in_username">br>
密碼:input type = "password" name = "in_password">br>
input type = "submit" name = "submit" value = "提交">
/form>
/body>
/html>

register.jsp部分:
復(fù)制代碼 代碼如下:

%@ 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 'register.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">
meta http-equiv = "content-type" content = "text/html;charset = gb2312">
!--
link rel="stylesheet" type="text/css" href="styles.css">
-->
/head>
body>
br>
%! boolean isnotlogin = false;%>
%
String username = request.getParameter("username");
String password = request.getParameter("password");
if(username == null || password == null)
{
response.sendRedirect("error.jsp");
return;
}
%>
jsp:useBean id="person" scope = "page" class = "mypack.register">
jsp:setProperty name = "person" property = "username" param = "username"/>
jsp:setProperty name = "person" property = "pwd" param = "password"/>
/jsp:useBean>
%
isnotlogin = person.judge();
if(!isnotlogin)
{
response.sendRedirect("error.jsp");
return;
}
else
{
session.setAttribute("username", request.getParameter("username"));
%>
jsp:forward page = "sbmt">
jsp:param name = "username" value = "%=username%>"/>
/jsp:forward>
%
}
%>
/body>
/html>

register.java(JavaBean)部分:
復(fù)制代碼 代碼如下:

package mypack;
public class register {
private String username = "";
private String pwd = "";
public void setUserName(String nm)
{
this.username = nm;
}
public String getUserName()
{
return this.username;
}
public void setPwd(String pd)
{
this.pwd = pd;
}
public String getPwd()
{
return this.pwd;
}
public boolean judge()
{
boolean temp = false;
if(username.equals("teacher") pwd.equals("teacher"))
{
temp = true;
}
return temp;
}
}
sbmt.java(Servlet)部分:
package mypack;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class sbmt extends HttpServlet {
private static final long serialVersionUID = 1L;
public sbmt() {
super();
}
public void destroy() {
super.destroy();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("HTML>");
out.println(" HEAD>TITLE>A Servlet/TITLE>/HEAD>");
out.println(" BODY>");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the GET method");
out.println(" /BODY>");
out.println("/HTML>");
out.flush();
out.close();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession(false);
if(session == null)
{
response.sendRedirect("error.jsp");
return;
}
String usernameone = (String)session.getAttribute("username");
String usernametwo = request.getParameter("username");
if(!usernameone.equals(usernametwo))
{
response.sendRedirect("error.jsp");
return;
}
response.setContentType("text/html;charset = GBK");
request.setAttribute("username", usernametwo);
if(usernametwo.equals("teacher"))
{
response.sendRedirect("teacher.jsp");
return;
}
else
{
response.sendRedirect("error.jsp");
return;
}
}
}
}

標(biāo)簽:梅州 吳忠 昌都 臨沂 白銀 黔東 南充 肇慶

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《關(guān)于JSP的一點(diǎn)疑問小結(jié)》,本文關(guān)鍵詞  關(guān)于,JSP,的,一點(diǎn),疑問,小結(jié),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《關(guān)于JSP的一點(diǎn)疑問小結(jié)》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于關(guān)于JSP的一點(diǎn)疑問小結(jié)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 江达县| 长治县| 雅安市| 梅州市| 肥东县| 依兰县| 盈江县| 襄垣县| 麻阳| 仁怀市| 都昌县| 绥宁县| 宜阳县| 安新县| 兴业县| 金坛市| 诏安县| 从江县| 筠连县| 古浪县| 古交市| 玉屏| 稷山县| 洛扎县| 昂仁县| 汉源县| 许昌县| 金昌市| 平顶山市| 应城市| 霍邱县| 拉萨市| 湟源县| 遂昌县| 封开县| 驻马店市| 双江| 塘沽区| 金塔县| 蕉岭县| 马山县|