最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Java web代碼和學(xué)習(xí)筆記JSP實現(xiàn)完整的登錄注冊功能的界面,解決大多之法【詩書畫唱】

2020-09-15 21:00 作者:詩書畫唱  | 我要投稿

實現(xiàn)UserDao中的add方法,最終完成注冊功能,實現(xiàn)完整的登錄注冊功能




--drop? ?table? User

?


create table User(

id int primary key auto_increment,



act varchar(100) ,


pwd varchar(100) ,

sex char(100) ,


brith date,



hobbys? ?varchar(100)


);

--drop table? User

--insert into User(act ,pwd ,sex ,brith,hobbys ) values ("1","1",'男','2000-7-9',"編程");

--select *? from User




package com.SSHC.bean;


import java.util.Date;


//bean的類名于表的名字一致,而且首字母必須大寫

public class User {

? ? //bean類中的屬性名應(yīng)該和表中的列名一致

private Integer id;

private String act;

private String pwd;

private String birth;

private String sex;

private String hobbys;

public Integer getId() {

return id;

}

public void setId(Integer id) {

this.id = id;

}

public String getAct() {

return act;

}

public void setAct(String act) {

this.act = act;

}

public String getPwd() {

return pwd;

}

public void setPwd(String pwd) {

this.pwd = pwd;

}

public String getBirth() {

return birth;

}

public void setBirth(String birth) {

this.birth = birth;

}

public String getSex() {

return sex;

}

public void setSex(String sex) {

this.sex = sex;

}

public String getHobbys() {

return hobbys;

}

public void setHobbys(String hobbys) {

this.hobbys = hobbys;

}


}



package com.SSHC.DAO;


import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.util.ArrayList;

import java.util.List;


import com.SSHC.Utils.DBUtils;

import com.SSHC.bean.User;



//Dao是數(shù)據(jù)訪問的意思,

//在這個類中負責(zé)對user表進行增刪改查的功能實現(xiàn)

//Dao類中的方法就是負責(zé)執(zhí)行sql語句,只要有執(zhí)行sql語句的代碼都必須寫在dao類中

public class UserDao {

? ? public User selectByActAndPwd(String act,String pwd){??

? ? String sql = "select * from user"

? ? + " where act = ? and pwd = ?";

? ? Connection conn = null;

? ? PreparedStatement pstm = null;

? ? ResultSet rs = null;

? ? User u = new User();

? ? try {

? ? ? ? conn = DBUtils.getConn();

pstm = conn.prepareStatement(sql);

//設(shè)置占位符

pstm.setString(1, act);

pstm.setString(2, pwd);

rs = pstm.executeQuery();

if(rs.next()) {

Integer id = rs.getInt("id");

u.setId(id);

u.setAct(act);

u.setPwd(pwd);

}

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} finally {

//清理資源

DBUtils.close(rs, pstm, conn);

}

? ? return u;

? ? }

? ??

? ? //在user表中新增一條數(shù)據(jù)

? ? public Integer add(User u) {

? ?

//? ? List<User> L=new ArrayList<User>();

//? ?

//? ? L.add(u);

//? ?

//? ? String act=null;

//? ? String pwd=null;

//? ? String sex=null;

//? ? String brith=null;

//? ? String hobbys=null;

//? ? String[]arr={act,

//? ? pwd,sex,brith, hobbys};

//? ? for (int i = 0; i < L.size(); i++) {

//? ? User p = L.get(i);

//? ?

//? ? ? ? System.out.println(p);

// }

? ? String sql = "insert into User(act ,pwd "

+ ",sex ,brith,hobbys ) values (?,?,?,?,?);";

? ? Connection conn = null;

? ? PreparedStatement pstm = null;

? ? ResultSet rs = null;

? ??

? ? try {

? ? ? ? conn = DBUtils.getConn();

pstm = conn.prepareStatement(sql);

//設(shè)置占位符

//System.out.println(u.getAct());

pstm.setObject(1,u.getAct());

pstm.setObject(2,u.getPwd() );

pstm.setObject(3,u.getSex());

pstm.setObject(4, u.getBirth());

pstm.setObject(5, u.getHobbys());


pstm.executeUpdate();

? ? ? ? } catch (SQLException e) {

? ? ? ? ? ? // TODO Auto-generated catch block

? ? ? ? ? ? e.printStackTrace();

? ? ? ? }finally{

?

? ? ? ? ? ?

DBUtils.close(rs, pstm, conn);

}

? ? return 0;

? ? }

? ? public static void main(String[] args) {

//? ? UserDao ud = new UserDao();

//? ? User u = ud.selectByActAndPwd("admin2020", "1111");

//? ? if(u.getId() != null && u.getId() > 0) {

//? ? System.out.println("登錄成功");

//? ? } else {

//? ? System.out.println("登錄失敗");

//? ? }

}

}

package com.SSHC.Utils;


import java.io.IOException;

import java.io.InputStream;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.util.Properties;


public class DBUtils {

private static String driverName;

? ? private static String url;

? ? private static String user;

? ? private static String pwd;

? ??

? ? static {

? ? //讀取properties文件

? ? Properties prop = new Properties();

? ? //將db.properties文件讀取到內(nèi)存中去

? ? InputStream is = DBUtils.class.getClassLoader()

? ? .getResourceAsStream("db.properties");

? ? //加載內(nèi)容

? ? try {

prop.load(is);

//讀取內(nèi)容

driverName = prop.getProperty("dn");

//System.out.println(driverName);

url = prop.getProperty("url");

user = prop.getProperty("un");

pwd = prop.getProperty("up");

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

? ? }

? ??

? ? //獲取數(shù)據(jù)庫連接對象的方法

? ? public static Connection getConn(){

? ? Connection conn = null;

? ? try {

Class.forName(driverName);

conn = DriverManager

.getConnection(url,user,pwd);

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}? ?

? ? return conn;

? ? }

? ??

? ? public static void close(ResultSet

? ? rs,PreparedStatement pstm

? ? ,Connection conn){

? ? ? ? try {

? ? ? ? if(rs != null) {

? ? ? ? ? ? rs.close();

? ? ? ? ? ? }

? ? ? ? ? ? if(pstm != null) {

? ? ? ? ? ? pstm.close();

? ? ? ? ? ? }

? ? ? ? ? ? if(conn != null) {

? ? ? ? ? ? conn.close();

? ? ? ? ? ? }

? ? ? ? } catch(Exception e) {

? ? ? ? e.printStackTrace();

? ? ? ? }

? ? }

}





dn=com.mysql.jdbc.Driver

url=jdbc:mysql://localhost:3306/firstjsp?useUnicode=true&characterEncoding=UTF-8

un=root

up=root

【個人的發(fā)現(xiàn)和解決方法:

href和src等鏈接有關(guān)的改成hreff和srcc等才可以保存在b站等的專欄上,不然會報“請檢查網(wǎng)絡(luò)”等的提示等,復(fù)制粘貼我辛苦寫的代碼時,記得三連和關(guān)注我,并且改回href和src,

用選中紅線后,按Ctrl+F,點Replace All用空格或“什么都沒有”等替換紅線后,就不會報紅線】






<%@ page language="java" contentType="text/html;?

charset=UTF-8" 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 hreff="<%=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">

? ? ? ? <style type="text/css">

? ? ? ? ? ? *{

? ? ? ? ? ? ? ? font-size:50px;

? ? ? ? ? ? }

? ? ? ? </style>

? ? ? ? <!-- 引用日期腳本文件 -->

? ? ? ? <script type="text/javascript" srcc="js/datepicker.js">

? ? ? ? </script>

? ? ? ? <script type="text/javascript">

? ? ? ? ? ? //表單驗證函數(shù)

? ? ? ? ? ? //當(dāng)這個函數(shù)返回true時,就會執(zhí)行action中的代碼

? ? ? ? ? ? //如果這個函數(shù)返回false,那么就不會執(zhí)行action中的代碼

? ? ? ? ? ? function doCheck(){

var flag = true;//表單驗證默認(rèn)是通過的

? ? ? ? ? ? //賬號的長度必須在6到30位之間

var act = document.getElementsByName('act')[0].value;

? ? ? ? ? ? //獲取輸入的賬號的長度

var len = act.length;

if(len < 6 || len > 30) {

? ? ? ? ? ? flag = false;

alert('賬號的長度必須在6到30位之間');

? ? ? ? ? ? }

? ? ? ? ? ? //獲取到第一次輸入的密碼

var pwd = document.getElementsByName('pwd')[0].value;

? ? ? ? ? ? //獲取到第一次輸入的密碼的長度

? ? ? ? ? ? len = pwd.length;

? ? ? ? ? ? if(len < 6 || len > 30) {

? ? ? ? ? ? flag = false;

? ? ? ? ? ? alert('密碼的長度必須在6到30位之間');

? ? ? ? ? ? }

? ? ? ? ? ? //兩次輸入的密碼必須一致

? ? ? ? ? ? //獲取第二次輸入的密碼

?var pwd1 = document.getElementsByName('pwd1')[0].value;

? ? ? ? ? ? if(pwd != pwd1) {

? ? ? ? ? ? flag = false;

? ? ? ? ? ? alert('兩次輸入的密碼不一致');

? ? ? ? ? ? }

? ? ? ? ? ? return flag;

? ? ? ? ? ? }

? ? ? ? </script>

? ? </head>

? ? <body>

? ? ? ? <!-- onsubmit事件表單提交以前 -->

<form action="doReg.jsp" method="post"?

onsubmit="return doCheck();">

? ? ? ? ? ? <table border="1">

? ? ? ? ? ? ? ? <tr>

? <td><span style="color:red;">*</span>賬號:</td>

? ? ? ?<td><input type="text" name="act" /></td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ?<td><span style="color:red;">*</span>密碼:</td>

? ? ? <td><input type="password" name="pwd" /></td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td>確認(rèn)密碼:</td>

? ?<td><input type="password" name="pwd1" /></td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td>生日:</td>

? ? ? ? ? ? ? ? ? ? <td>

? ? ? ? ? ? ? ? ? ? ? ? <input type="text" name="birth"?

? ?readonly onclick="new Calendar().show(this);" />

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td>性別:</td>

? ? ? ? ? ? ? ? ? ? <td>

?<input type="radio" name="sex" value="男" checked />男

? <input type="radio" name="sex" value="女" />女

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td>愛好:</td>

? ? ? ? ? ? ? ? ? ? <td>

?<input type="checkbox" name="hobbys" value="閱讀" />看書

<input type="checkbox" name="hobbys" value="打球" />做視頻

<input type="checkbox" name="hobbys" value="游泳" />給詩書畫唱三連

?<input type="checkbox" name="hobbys" value="LOL" />給詩書畫唱關(guān)注

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td colspan="2" align="center">

?<input type="submit" value="注冊" />

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? </table>

? ? ? ? ? ? <div style="color:red;">${msg }</div>

? ? ? ? </form>

? ? </body>

</html>





<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>

<%@page import="java.text.SimpleDateFormat"%>

<%@page import="com.SSHC.bean.User"%>


<%@page import="java.util.*"%>


<%@page import="com.SSHC.DAO.UserDao"%>

<%@ page language="java" contentType

="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%

? ? //亂碼處理

? ? request.setCharacterEncoding("utf-8");

? ? //1、獲取表單中輸入的數(shù)據(jù)

? ? String act = request.getParameter("act");

? ? String pwd = request.getParameter("pwd");

? ? String pwd1 = request.getParameter("pwd1");

? ? String birth = request.getParameter("birth");

? ? String sex = request.getParameter("sex");

? ? String[] hobbys = request.getParameterValues("hobbys");

? ? //將hobbys數(shù)組轉(zhuǎn)換成一個字符串

? ? StringBuilder hbs = new StringBuilder();

? ? if(hobbys != null) {//如果沒有選興趣愛好,hobbys就是null

? ? String dot = "";

? ? for(int i = 0;i < hobbys.length;i ++) {

? ? hbs.append(dot);

? ? hbs.append(hobbys[i]);

? ? dot = ",";

? ? }

? ? System.out.println(hbs);//游泳,閱讀,LOL

? ? }

? ? //將數(shù)據(jù)打包

? ? User u = new User();

? ? u.setAct(act);

? ? u.setPwd(pwd);

? //? try {

? ?/**SimpleDateFormat format =?

?new SimpleDateFormat("yyyy-MM-dd");

? ?

?

? ? ? ? Date myDate = format.parse(birth);

? ? ? ? System.out.println(myDate);

? ? ? ? */


? ? //? ? Date myDate = new? Date(birth);?

? ? ? ? //System.out.println(birth);

? ? u.setBirth(birth);

? ? u.setSex(sex);

? ? u.setHobbys(hbs.toString());

? ? //2、后臺驗證(省略)

? ? //3、注冊(新增一條數(shù)據(jù))

? ? ? System.out.println(act+pwd+birth+sex+hbs.toString());

UserDao ud = new UserDao();

/* *? List<User>list = new ArrayList<User>();

? ?for(int i = 0;i < list.size();i ++) {

? ?User p = list.get(i);

? ? System.out.println(p);

? ?}*/

? ?ud.add(u);

? ?

?Integer count = ud.add(u);

System.out.println(act.length());


? //? System.out.println(count);

? ??

? //? ?UserDao UserDao= new UserDao();


// List<User>list = UserDao.selectAll();





?//for(User U : list) {


//System.out.println(U);


?//}?


? ? //4、結(jié)果處理(也可以

? ? /**

? ? 詩書畫唱個人分享的個人總結(jié)的

? ? 注意事項:

? ?

? ? Integer count = ud.add(u)+1;

? ? 后count=1,用if(count>0){}或

? ? if(

?act.trim().length* pwd.trim().length

? ? * pwd1.trim().length

? ? * birth.trim().length

? ? * sex.trim().length

? ? * hobbys.trim().length>0){}

? ?

? ? 或

? ? if(

? ? ? ? act.trim().length>0&&

? ? ? ? pwd.trim().length>0

? ? ? ? && pwd1.trim().length>0

? ? ? ? && birth.trim().length>0

? ? ? ? && sex.trim().length>0

? ? ? ? && hobbys.trim().length>0){}

? ? ):

? ?

? ? 但如果reg,DAO等中已經(jīng)設(shè)置了約束,滿足約束

? ? 后才可跳轉(zhuǎn)到doReg,那么這里只要

? ? u!=null或其他去除空格后長度大于0,就可以了。

? ??

? ? 因為空格有時也有長度。

? ? */

? ? if(u!=null) {//a、注冊成功,跳轉(zhuǎn)到login.jsp

? ? //注冊成功后將賬號自動的填入到登錄的賬號輸入框中

? ? request.setAttribute("userName", act);

? ? request.getRequestDispatcher("login.jsp")

? ? ? ? .forward(request, response);

? ? }else?

? ? {//b、注冊失敗,跳轉(zhuǎn)到reg.jsp,同時提示注冊失敗

? ? String msg = "注冊失敗,請聯(lián)系系統(tǒng)管理員";

? ? ? ? request.setAttribute("msg", msg);

? ? request.getRequestDispatcher("reg.jsp")

? ? ? ? .forward(request, response);

? ? }??

? //? } catch (Exception e) {

? ?//? ? ?e.printStackTrace();

? //? }

%>



<%@ page language="java" contentType="text/html; charset=UTF-8" 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 hreff="<%=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">

? ? ? ? <style type="text/css">

? ? ? ? ? ? *{

? ? ? ? ? ? ? ? font-size:50px;

? ? ? ? ? ? }

? ? ? ? </style>

? ? </head>

? ? <body>

? ? ? ? <form action="doLogin.jsp" method="post">

? ? ? ? ? ? <table border="1">

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td>賬號:</td>

? ? ? ? ? ? ? ? ? ? <td><input type="text" name="act" value="${userName }"

? ? ? ? ? ? ? ? ? ? ? ? placeholder="請輸入賬號"/></td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td>密碼:</td>

? ? ? ? ? ? ? ? ? ? <td><input type="password" name="pwd" /></td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? ? <td colspan="2" align="center">

? ? ? ? ? ? ? ? ? ? ? ? <input type="submit" value="提交" />

? ? ? ? ? ? ? ? ? ? </td>

? ? ? ? ? ? ? ? </tr>

? ? ? ? ? ? </table>

? ? ? ? ? ? <div>${msg }</div>

? ? ? ? </form>

? ? </body>

</html>




<%@page import="com.SSHC.bean.User"%>

<%@page import="com.SSHC.DAO.UserDao"%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%

? ? //中文亂碼處理

? ? request.setCharacterEncoding("utf-8");

? ? //1、獲取用戶輸入的賬號和密碼

? ? String act = request.getParameter("act");

? ? String pwd = request.getParameter("pwd");

? ? System.out.println(act);

? ? //2、查詢數(shù)據(jù)庫

? ? UserDao userDao = new UserDao();

? ? User u = userDao.selectByActAndPwd(act, pwd);

? ? //3、根據(jù)查詢出來的結(jié)果進行處理

? ? if(u.getId() != null && u.getId() > 0) {

? ? //將登錄的賬號存放到session

? ? //后面當(dāng)你跳轉(zhuǎn)到任何的頁面時,還需要驗證是否是合法的訪問

? ? request.getSession().setAttribute("userName", act);

? ? //a、根據(jù)賬號和密碼能夠查詢記錄,就表示登錄成功,跳轉(zhuǎn)到后臺管理頁面

? ? request.getRequestDispatcher("manage.jsp").forward(request, response);

? ? } else {

? ? String msg = "賬號或者密碼錯誤";

? ? request.setAttribute("msg", msg);

? ? //b、沒有查詢到記錄,就表示登錄失敗,跳轉(zhuǎn)回login.jsp

? ? request.getRequestDispatcher("login.jsp").forward(request, response);

? ? }? ?

%>


<%@ page language="java" contentType="text/html; charset=UTF-8" 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 hreff="<%=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">

? ? </head>

? ? <body>

? ? ? ? <h1>Hi!歡迎登錄本系統(tǒng),${userName }</h1>

? ? </body>

</html>





運行:



——————————————————————————————————


常用單詞和用來區(qū)別或理解的內(nèi)容等:

manage為登錄成功后的界面,之后可以寫用于管理等方面的代碼,實現(xiàn)其管理功能的程序等






個人分享的解決問題的方法:

當(dāng)自己某一個內(nèi)容不知道怎么容,可以百度(或其他的搜索引擎),之后找到會綜合處可以類比出答案等的內(nèi)容:

比如我用jsp不知道怎么寫DAO中的增加的封裝的方法,那么我就百度和其有關(guān)的認(rèn)為可以搜索到想要內(nèi)容的關(guān)鍵詞“jsp增刪改查學(xué)生表”。

https://www.sogou.com/link?url=hedJjaC291P3yGwc7N55kLSc2ls_Ks2xoSDzGT_y3Rrr1m3DJA85oHqIGYLXQ54N

這里面用了類比后的百度的內(nèi)容



——————————



學(xué)習(xí)筆記:

一、登錄功能


知道實現(xiàn)一個功能的步驟

1、在mysql數(shù)據(jù)庫中創(chuàng)建一個表user,表結(jié)構(gòu):id,act,pwd

"2、搭建項目,需要創(chuàng)建一些包:

com.jy.bean:com/jy/bean,對應(yīng)每個表中的一條數(shù)據(jù)的,你有幾個表就創(chuàng)建一個bean

com.jy.dao:com/jy/dao,負責(zé)對表進行增刪改查的,你有一個表就創(chuàng)建一個dao"

"com.jy是怎么來的:根據(jù)你所在的公司的網(wǎng)址來確定,www.jy.com,你的包名就將網(wǎng)址

倒過來寫就可以了com.jy"

"3、將數(shù)據(jù)庫的配置文件db.properties放到src目錄下,同時將數(shù)據(jù)庫的驅(qū)動包拷貝到

工程的lib目錄下。將數(shù)據(jù)庫連接工具類拷貝到工程目錄下"

4、創(chuàng)建login.jsp頁面

"5、設(shè)計登錄的action即doLogin.jsp頁面,因為這個頁面沒有需要展示的東西,所以

我們將它的所有的html代碼都刪除。然后將doLogin.jsp的相對路徑寫到表單的actiion屬性中。"

6、實現(xiàn)登錄的業(yè)務(wù),編寫登錄的代碼


在項目中,一個方法的功能越簡單越單一就越能夠復(fù)用


二、登錄注冊功能:驗證碼,人臉識別,短信驗證

普通的注冊:輸入賬號密碼(輸入兩次),生日,學(xué)歷,愛好等

1、創(chuàng)建reg.jsp頁面

2、設(shè)計一個業(yè)務(wù)處理頁面doReg.jsp,將表單中的action設(shè)置為這個業(yè)務(wù)處理頁面

3、表單驗證,保證用戶輸入的數(shù)據(jù)是正確的,不會破壞后臺的數(shù)據(jù)庫中的數(shù)據(jù)


個人的提示和發(fā)現(xiàn):

運行是要注意,可以鼠標(biāo)右鍵點“Run as”,分別有只運行Java代碼或者是運行JSP的部分等的代碼等。



做項目等先做界面,之后就可以有很多的思路,靈感等。


個人想出的創(chuàng)新的方法:



Java web代碼和學(xué)習(xí)筆記JSP實現(xiàn)完整的登錄注冊功能的界面,解決大多之法【詩書畫唱】的評論 (共 條)

分享到微博請遵守國家法律
滕州市| 永济市| 毕节市| 甘德县| 项城市| 清新县| 茂名市| 浏阳市| 会昌县| 辉县市| 凤台县| 法库县| 平潭县| 和顺县| 姜堰市| 伊宁市| 白城市| 济阳县| 辽宁省| 临汾市| 长沙县| 容城县| 阿鲁科尔沁旗| 西藏| 甘德县| 天祝| 阿鲁科尔沁旗| 旬阳县| 理塘县| 老河口市| 高台县| 修文县| 柳州市| 武强县| 古浪县| 屏山县| 仁化县| 莫力| 甘谷县| 万源市| 临朐县|