當前位置:首頁 » 網頁前端 » javaweb登錄注冊代碼
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

javaweb登錄注冊代碼

發布時間: 2022-12-12 11:24:28

⑴ JAVA WEB 資料庫為後台 注冊效果不能成功

問的問題太大了,顯示「注冊失敗」,我猜的意思是,你做個注冊功能,在用servlet返回的時候在jsp
顯示「注冊失敗」。
我看了一下代碼,其實很簡單:你注冊是提交到RegisterServlet上面的,返回失敗是:

boolean flag =uo.add(user);
//4.
PrintWriter out = response.getWriter();
if(flag){
out.print("<h3>注冊成功,請登錄!</h3>");
}else{
out.print("<h3>注冊失敗,請重試!</h3>");
}
因此,就是你保存的時候uo.add(user)反回false:
//用戶注冊方法
public boolean add(User user){
int flag = 0;
sql = "insert into user_info values(?,?,?,?)";
try {
psmt = con.prepareStatement(sql);
psmt.setString(1,user.getName());
psmt.setString(2,user.getPassword());
psmt.setString(3,user.getPhone());
psmt.setString(4,user.getEmail());
flag = psmt.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return flag>0?true:false;
}
所以flag = psmt.executeUpdate();這個有問題,你再仔細看看

⑵ 大神,跪求java web 一個用戶用戶注冊登錄,不用連接資料庫,不要連接資料庫!!

這個簡單,定義一個static Map<String,User>,每注冊一個就往Map中put一條數據,以登錄名為key,以用戶User類為value。
登錄的時候拿著登錄名去找Map,如果有匹配到就對比密碼是否正確,密碼輸入正確就表示可以登錄成功,密碼匹配錯誤就提示密碼錯誤;
如果拿著登錄名找Map沒有找到信息,說明此登錄名沒有注冊,就是提示注冊。

⑶ java web 的一個登錄注冊案例,控制台出現At least one JAR was scanned for TLDs yet contained no TLDs

user是一個對象,重寫一下user的tostring方法

⑷ javaweb的學生注冊登錄(學號,姓名,密碼),刪除,修改

如果不多的話就直接修改 要更新就 update table set id='19'+substring(id,1,4)+'00'+substring(id,5,3)

⑸ 用java web編寫一個用戶注冊界面(只要寫出以下要求就行)

一步步更新:頁面
<form action="regist.servlet" method="post"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" class="tableAdd borTop"> <tr> <th width="14%" height="30" nowrap>用戶名</th> <td class="pl5"> <INPUT id="sName" name="name" type="text" size="20"> </td> </tr> <tr> <th width="14%" height="30" nowrap>密碼</th> <td class="pl5"> <INPUT name="password" type="password" size="20"> </td> </tr> <tr> <th width="14%" height="30" nowrap>確認密碼</th> <td class="pl5"> <INPUT name="confrimPwd" type="password" size="20"> </td> </tr> <tr> <th width="14%" height="30" nowrap>性別</th> <td class="pl5"> 男<INPUT name="sex" type="radio" value="1" checked="checked" size="20"> 女<INPUT name="sex" type="radio" value="0" size="20"> </td> </tr> <tr> <th width="14%" height="30" nowrap>愛好</th> <td class="pl5"> <INPUT name="enjoy" type="checkbox" size="20" value="籃球">籃球 <INPUT name="enjoy" type="checkbox" size="20" value="足球">足球 </td> </tr> <tr> <th width="14%" height="30" nowrap>生日</th> <td class="pl5"> <INPUT name="brithday" type="text" size="20"> </td> </tr> <tr> <th width="14%" height="30" nowrap>備注</th> <td class="pl5"> <textarea rows="5" cols="200" name="remark"></textarea> </td> </tr> <tr> <th width="14%" height="30" nowrap> </th> <td class="pl5"> <input type="submit" value="提交"> <input type="reset" value="重置"> </td> </tr></table></form>

資料庫部分:
import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import com.mysql.jdbc.Connection;import com.mysql.jdbc.Statement;public class DataBaseUtil { public static Connection getConnection() throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); Connection conn = (Connection) DriverManager.getConnection("jdbc:mysql://192.168.100.113/datebase", "username", "password"); return conn; } public static Statement getPS() throws ClassNotFoundException, SQLException { Statement statement = (Statement) getConnection().createStatement(); return statement; } public static void close(Connection conn,Statement st,ResultSet rs) throws SQLException{ if(rs != null) { rs.close(); } if(st != null) { st.close(); } if(conn != null) { conn.close(); } }}

⑹ 誰有JavaWeb版本的在線考試系統,求完整源代碼。

基於java web的在線考試系統,我有的。資料庫:mysql
主要功能:注冊、登錄 考試 查詢 等功能

⑺ 用javaweb寫的簡單圖書管理系統登錄注冊不管用

簡單的說存在以下錯誤
1HandleLogin里用戶名密碼不正確,無法連接到資料庫,但未做異常處理,應該把資料庫用戶密碼設置用常量,其它文件里只讀取

2login存在兩個同名的servlet,不知道你使用的是那個,系統最後調用的是myservlet.control.HandleLogin

⑻ 求一個java web項目,有注冊登錄頁面,之後實現增刪改查功能就可以,求,,,

網上隨便找個 刪去多餘的就可以了 找個很多的

qun一起來學習進步
6三,827伍 ---這里是分割線----- 久。85

⑼ 急急急!!!!在線等!!javaweb怎麼判斷管理員和普通用戶登錄,求代碼!!!

if(request.getParameter("userclass").equals("用戶"))
...
else if(request.getParameter("userclass").equals("管理員")
...
else
...