4.14
public class tea { private int uid; private String uname; private String upass; //访问器 public int getUid() { return uid; } public void setUid(int uid) { this.uid = uid; } public String getUname() { return uname; } public void setUname(String uname) { this.uname = uname; } public String getUpass() { return upass; } public void setUpass(String upass) { this.upass = upass; } //构造器 public tea(int uid, String uname, String upass) { super(); this.uid = uid; this.uname = uname; this.upass = upass; } public tea() { super(); } }
body { margin:0; height:1080; width:1920; background-image:url(beijing.png); background-repeat:no-repeat; } ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; position: fixed; top: 0; width: 100%; } li { float: left; } li a { display: block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover:not(.active) { background-color: #111; } p { text-align:center; } .active { background-color: #4CAF50; } .form { width:350px; height:200px; background-color:rgba(1,0,1,0.5); } .weizhi { position:relative; top:200px; left:610px; } .up { position: relative; top:150px; }
<%@page import="com.gd.dao.StuDao"%> <%@page import="com.gd.bean.Stu"%> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% Stu s = new Stu(); String uname = request.getParameter("uname"); s.setUname(uname); String upwd = request.getParameter("upwd"); s.setUpwd(upwd); StuDao sd=new StuDao(); if(sd.addStu(s)>0){ //跳转注册成功页面 request.getRequestDispatcher("welcome.jsp").forward(request,response); }else{ //错误页面 request.getRequestDispatcher("no.jsp").forward(request,response); } %>
<%@page import="com.gd.dao.stuDao"%> <%@page import="com.gd.bean.stu"%> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% stu s = new stu(); int id = Integer.parseInt(request.getParameter("sid")); s.setSid(id); String uname = request.getParameter("uname"); s.setUname(uname); String upwd = request.getParameter("upwd"); s.setUpwd(upwd); stuDao sd=new stuDao(); if(sd.addstu(s)>0){ //跳转注册成功页面 }else{ //错误页面 } %> <% if(uname.equals("zs")&&upwd.equals("123")){ //跳转成功登录页面 request.getRequestDispatcher("welcome.jsp").forward(request, response); session.setAttribute("uname",uname); } else{ //错误页面 request.getRequestDispatcher("index.jsp").forward(request, response); } %>