-
當(dāng)前位置:首頁 > 創(chuàng)意學(xué)院 > 技術(shù) > 專題列表 > 正文
效果圖
代碼
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>先鋒圖書館管理系統(tǒng)-登錄</title>
<style>
*{
margin: 0;
padding: 0;
list-style: none;
}
#top{
width: 1000px;
height: 95px;
margin: 0 auto;
margin-top: 25px;
}
#top_top{
width: 1000px;
height: 65px;
background: deepskyblue;
}
#top_top_left{
width: 300px;
height: 65px;
float: left;
}
#top_top_left>label{
width: 200px;
height: 65px;
color: white;
float: right;
}
#top_top_left>#a2{
padding-left: 10px;
padding-top: 20px;
font-size: 16px;
}
#top_bottom{
width: 1000px;
height: 30px;
}
#top_bottom_left{
width: 340px;
height: 30px;
line-height: 30px;
font-size: 12px;
background: skyblue;
color: white;
text-indent: 2em;
float: left;
}
#top_bottom_right{
width: 660px;
height: 30px;
line-height: 30px;
font-size: 12px;
color: blueviolet;
text-align: center;
float: right;
background: lightskyblue;
}
#content{
width: 1000px;
height: 600px;
margin: 0 auto;
background:#587FBA;
}
#content>#text{
width: 1000px;
height: 50px;
line-height: 50px;
padding-top: 100px;
font-size: 36px;
font-family:"楷體";
font-weight: bold;
text-align: center;
}
#content>#login{
width: 480px;
height: 210px;
margin-top: 20px;
margin-left: 260px;
background: #85A0CB;
}
#content>#login>img{
float: left;
}
#content>#login>#select{
width: 305px;
height: 210px;
float: right;
}
#content>#login>#select>div{
width: 230;
height: 30px;
margin-left: 30px;
}
#content>#login>#select>#d1{
margin-top:30px;
margin-bottom: 3px;
}
#content>#login>#select>p{
font-size: 14px;
margin-left: 95px;
}
#bottom{
width: 1000px;
height: 35px;
line-height: 35px;
margin: 0 auto;
background: deepskyblue;
text-align: center;
color: white;
}
</style>
</head>
<body>
<div id="top">
<div id="top_top">
<div id="top_top_left">
<img src="img/test/a13.png" width="78px" height="65px"><label id="a2">先鋒圖書館系統(tǒng)管理平臺</label>
</div>
</div>
<div id="top_bottom">
<div id="top_bottom_left">當(dāng)前位置 : 首頁 > 系統(tǒng)管理 > 登錄</div>
<div id="top_bottom_right">當(dāng)前時(shí)間 : <label id="lable"></label></div>
</div>
</div>
<div id="content">
<div id="text">歡迎登錄先鋒圖書館管理系統(tǒng)</div>
<div id="login">
<img src="img/test/a14.png" width="175px" height="210px"/>
<form id="select">
<div id="d1">用戶名: <input type="text" /></div>
<div>密 碼: <input type="password" /></div>
<p>
<input type="radio" name="user" value="read"/>讀者
<input type="radio" name="user" value="admin"/>管理員
</p><br/>
<p>
<input type="button" value="確定" style="width: 50px;" onclick="put()"/>
<input type="reset" value="重置" style="width: 50px;"/>
</p>
</form>
</div>
</div>
<div id="bottom">欣欣科技有限公司版權(quán)所有</div>
</body>
<script type="text/javascript" src="JQuery/jquery.js"></script>
<script type="text/javascript" src="js/GetCurrentTime.js"></script>
<script>
//驗(yàn)證用戶名和密碼
function put(){
var d = $("#select>div>input");//獲取用戶名和密碼
var name = d[0].value;
var pass = d[1].value;
var user = null;
var r = document.getElementsByName("user");//獲取用戶類型
for(i=0;i<r.length;i++){
if(r[i].checked){
user=r[i].value;
}
}
//console.log(name + "," +pass + "," +user);//輸出測試
if(user==null){
window.alert("請選擇用戶類型!");
}else if(user=="admin" && name!="admin"){
window.alter("用戶名錯誤!");
}else if(user=="admin" && name=="admin" && pass!="123456"){
window.alert("密碼錯誤!");
}else if(name=="admin" && pass=="123456" && user=="admin"){
window.location.href="work_02_welcome.html";//在js中在本頁面中打開新鏈接
}else{
window.alert("用戶名錯誤");
}
}
</script>
</html>
javaweb簡單的用戶登錄界面(javaweb用戶登錄頁面)
大家好!今天讓創(chuàng)意嶺的小編來大家介紹下關(guān)于javaweb簡單的用戶登錄界面的問題,以下是小編對此問題的歸納整理,讓我們一起來看看吧。
開始之前先推薦一個(gè)非常厲害的Ai人工智能工具,一鍵生成原創(chuàng)文章、方案、文案、工作計(jì)劃、工作報(bào)告、論文、代碼、作文、做題和對話答疑等等
只需要輸入關(guān)鍵詞,就能返回你想要的內(nèi)容,越精準(zhǔn),寫出的就越詳細(xì),有微信小程序端、在線網(wǎng)頁版、PC客戶端
官網(wǎng):https://ai.de1919.com。
創(chuàng)意嶺作為行業(yè)內(nèi)優(yōu)秀的企業(yè),服務(wù)客戶遍布全球各地,如需了解SEO相關(guān)業(yè)務(wù)請撥打電話175-8598-2043,或添加微信:1454722008
本文目錄:
一、用JAVA編寫一個(gè)用戶或注冊登錄界面。請哪位高手能夠?qū)懴戮唧w的代碼,謝謝
二、用jsp怎樣做一個(gè)用戶登錄界面
//jsp文件,登錄界面<%@page pageEncoding="utf-8" contentType="text/html; charset = utf-8"%>
<body>
<h1>Register</h1>
<hr />
<form action="login" method="post">
用戶名:
<input type="text" name="username" id="text" />
密 碼:
<input type="password" name="pwd" id="text" //>
<input type="submit" value="登錄" id="button" />
</form>
</body>
//這是server文件,web.xml部署名字loginimport java.io.IOException;
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 AddUser extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("utf-8");
String username=request.getParameter("username");
String pwd=request.getParameter("pwd");
try{
if(username.equals("name")&&pwd.equals("pwd") ){
system.out.print("登錄成功");
}else{
system.out.print("error");
}
}catch(Exception e){
e.printStackTrace();
}
}
}
簡單的登錄界面,不需要數(shù)據(jù)庫,如果要鏈接數(shù)據(jù)庫就要判斷很多了
三、用java web編寫一個(gè)用戶注冊界面(只要寫出以下要求就行)
一步步更新:頁面
<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>確認(rèn)密碼</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>
數(shù)據(jù)庫部分:
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(); } }}
四、用JAVA編一個(gè)用戶登錄界面,用戶必須輸入賬號密碼才能進(jìn)入
簡單代碼如下,原本想用彈窗的,懶得寫了:
import java.awt.Container;import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class dengru extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private Container c = null;
private JButton jb = null;
public dengru() {
this.setLayout(new FlowLayout());
jb = new JButton("登入");
jb.addActionListener(this);
this.add(jb);
this.setSize(500, 400);
this.setVisible(true);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
public static void main(String[] args) {
new dengru();
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jb) {
JFrame jf=new JFrame();
c = jf.getContentPane();
c.setLayout(new GridLayout(3,2,2,2));
JLabel jl1 = new JLabel("用戶名:");
JLabel jl2 = new JLabel("密 碼:");
JTextField jtf1 = new JTextField();
JTextField jtf2 = new JTextField();
jtf1.setSize(200, 40);
jtf2.setSize(200, 40);
c.add(jl1);
c.add(jtf1);
c.add(jl2);
c.add(jtf2);
c.add(new JButton("登入"));
jf.setVisible(true);
jf.setSize(300, 100);
jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
}
}
以上就是關(guān)于javaweb簡單的用戶登錄界面相關(guān)問題的回答。希望能幫到你,如有更多相關(guān)問題,您也可以聯(lián)系我們的客服進(jìn)行咨詢,客服也會為您講解更多精彩的知識和內(nèi)容。
推薦閱讀:
初中生學(xué)java需要多久(尚硅谷java培訓(xùn)多少錢)
java培訓(xùn)班學(xué)費(fèi)一般多少(零基礎(chǔ)Java開發(fā)工程師培訓(xùn)收費(fèi)標(biāo)準(zhǔn))
用java開發(fā)微信小程序(用java開發(fā)微信小程序代碼)
杭州關(guān)城小學(xué)(杭州關(guān)城小學(xué)是哪里)
粉面餐飲品牌設(shè)計(jì)字體(粉面招牌設(shè)計(jì))