效果图
代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>先锋图书馆管理系统-登录</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">先锋图书馆系统管理平台</label>
</div>
</div>
<div id="top_bottom">
<div id="top_bottom_left">当前位置 : 首页 > 系统管理 > 登录</div>
<div id="top_bottom_right">当前时间 : <label id="lable"></label></div>
</div>
</div>
<div id="content">
<div id="text">欢迎登录先锋图书馆管理系统</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">欣欣科技有限公司版权所有</div>
</body>
<script type="text/javascript" src="JQuery/jquery.js"></script>
<script type="text/javascript" src="js/GetCurrentTime.js"></script>
<script>
//验证用户名和密码
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用户登录页面)
大家好!今天让创意岭的小编来大家介绍下关于javaweb简单的用户登录界面的问题,以下是小编对此问题的归纳整理,让我们一起来看看吧。
开始之前先推荐一个非常厉害的Ai人工智能工具,一键生成原创文章、方案、文案、工作计划、工作报告、论文、代码、作文、做题和对话答疑等等
只需要输入关键词,就能返回你想要的内容,越精准,写出的就越详细,有微信小程序端、在线网页版、PC客户端
创意岭作为行业内优秀的企业,服务客户遍布全球各地,如需了解SEO相关业务请拨打电话175-8598-2043,或添加微信:1454722008
本文目录:
一、用JAVA编写一个用户或注册登录界面。请哪位高手能够写下具体的代码,谢谢
二、用jsp怎样做一个用户登录界面
//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();
}
}
}
简单的登录界面,不需要数据库,如果要链接数据库就要判断很多了
三、用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(); } }}
四、用JAVA编一个用户登录界面,用户必须输入账号密码才能进入
简单代码如下,原本想用弹窗的,懒得写了:
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);
}
}
}
以上就是关于javaweb简单的用户登录界面相关问题的回答。希望能帮到你,如有更多相关问题,您也可以联系我们的客服进行咨询,客服也会为您讲解更多精彩的知识和内容。
推荐阅读:
java培训班学费一般多少(零基础Java开发工程师培训收费标准)