六周
作者:互联网
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <style> body{ width:600; height:500px; overflow: hidden; position: relative; background-repeat: no-repeat; background-image:url(pp.JPG); } div{ width: 300px; height: 200px; padding-top: 100px; margin: 50px auto; background: #00000000; position:relative; top:100px; } form{ width: 300px; height: 200px; padding-top: 10px; margin: 50px auto; background: #00000000; border-radius: 20px; border: 3px solid #f8fcfc; opacity: 0.9; } </style> <head> </head> <% Integer count = (Integer)application.getAttribute("count"); if(count!=null){ count = 1+count; }else{ count = 1; } application.setAttribute("count",count); %> <body> <div> <form action="lo.jsp" method="post"> 账号:<input type="text" name="name"><br> 密码:<input type="password" name="password" ><br> <input type="submit" value="登录"> </form> </div> </body> </html>
<%@page import="java.nio.channels.SeekableByteChannel"%> <%@ page language="java" contentType="text/html" pageEncoding="UTF-8"%> <%@ page import="java.sql.*"%> <html> <head> </head> <body> <%!public static final String DBDRIVER = "com.mysql.jdbc.Driver"; public static final String DBURL = "jdbc:mysql://localhost:3306/userDatabase"; public static final String DBUSER = "root"; public static final String DBPASS = "123456";%> <% Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; boolean flag = false; String name = null; %> <% try { Class.forName(DBDRIVER); conn = DriverManager.getConnection(DBURL, DBUSER, DBPASS); String sql = "SELECT uname FROM num_one WHERE uid=? AND upwd=?"; pstmt = conn.prepareStatement(sql); pstmt.setString(1, request.getParameter("id")); pstmt.setString(2, request.getParameter("password")); rs = pstmt.executeQuery(); if (rs.next()) { name = rs.getString(1); flag = true; } } catch (Exception e) { e.printStackTrace(); } finally { try { if (rs != null) rs.close(); if (pstmt != null) pstmt.close(); if (conn != null) conn.close(); if (flag) { request.getSession().setAttribute("uname",name); request.getRequestDispatcher("false.jsp").forward(request,response); } else { response.sendRedirect("index.jsp"); } } catch (Exception e) { e.printStackTrace(); } } %> </body> </html>
<%@ page language="java" import="java.util.*" 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> </head> <body> <% String name = (String)session.getAttribute("name"); %> 欢迎你<% out.print("zs");%> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <% String Name = request.getParameter("name"); String Password = request.getParameter("password"); if(Name.equals("zs")&&Password.equals("123")){ request.getRequestDispatcher("false.jsp").forward(request,response); }else{ request.getRequestDispatcher("index.jsp").forward(request,response); } %> </html>
标签:00000000,top,100px,六周,height,width,background 来源: https://www.cnblogs.com/xxy02160216/p/14656186.html