https://www.myziyuan.com/
- nij
- <%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%><%@ page import="java.util.*" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <title>登录页面</title></head><body> <form name="loginForm" method="post" action="judgeUser.jsp"> <table> <tr> <td>用户名:<input type="text" name="userName" id="userName"></td> </tr> <tr> <td>密码:<input type="password" name="password" id="password"></td> </tr> <tr> <td><input type="submit" value="登录" style="background-color:pink"> <input type="reset" value="重置" style="background-color:red"></td> </tr> </table> </form></body></html><%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%><%@ page import="java.util.*" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <title>身份验证</title></head><body> <% request.setCharacterEncoding("GB18030"); String name = request.getParameter("userName"); String password = request.getParameter("password"); if(name.equals("abc")&& password.equals("123")) { %> <jsp:forward page="afterLogin.jsp"> <jsp:param name="userName" value="<%=name%>"/> </jsp:forward> <% } else { %> <jsp:forward page="login.jsp"/> <% } %></body></html> <%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <title>登录成功</title></head><body> <% request.setCharacterEncoding("GB18030"); String name = request.getParameter("userName"); out.println("欢迎你:" + name); %></body></html> 总共3个jsp文件,第一个是login.jsp,第2个是judge.jsp,第3个是afterLogin.jsp
- 2021-02-15 18:00:07
- 000000
- 看懂这个,就OK了,实现会员管理界面(会员查询,删除)<br>呵呵,注意下面两点,我标志的<br><br><%@pagecontentType="text/html;charset=UTF-8"language="java"%><br><%@pageimport="java.sql.*"%><br><%@pageimport="Bean.QueryBean"%><br><jsp:useBeanid="query"scope="page"class="Bean.QueryBean"/><br><html><br><head><br><metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"><br><title><br>admincontrol<br></title><br></head><br><%!<br>ResultSetrs=null;<br>Stringsql,login;<br>intcode;<br>intpagesize=3;<br>introwcount=0;<br>intpagecount=1,n;<br>intshowpage=1;<br>%><br><scriptlanguage="javascript"><br>functioncheck_delete()<br>{if(confirm("你确定它删除吗?"))<br>returntrue;<br>else<br>returnfalse;}<br></script><br><br><bodybgcolor="#ffffff"><br><ahref="index.jsp">返回首页<a><br><tableborder="1"width="786"align="center"bordercolor="#FFFFFF"cellpadding="0"cellspacing="0"bordercolordark="#333333"bordercolorlight="#FFFFFF"><br><tr><br><tdwidth="786"align="center"colspan="6"height="32">用户管理</td><br></tr><br><formname="form1"method="post"action=""><br><tr><br><tdwidth="18%"align="center"height="27">用户ID</td><br><tdwidth="17%"align="center"height="27">用户名</td><br><tdwidth="17%"align="center"height="27">用户身份</td><br><tdwidth="17%"align="center"height="27">注册时间</td><br><tdwidth="17%"align="center"height="27">管理</td><br></tr><br><%<br>sql="select*fromuserinfoorderbyaddtimedesc";//会员查询<br>try<br>{<br>rs=query.executeQuery(sql);<br>if(!rs.next())<br>{<br>%><br><scriptlanguage="javascript"><br>alert("没有用户信息");<br></script><br><%<br>}else<br>{<br>rs.last();<br>rowcount=rs.getRow();<br>pagecount=((rowcount%pagesize)==0?(rowcount/pagesize):(rowcount/pagesize)+1);<br>Stringtopage=request.getParameter("topage");<br>if(topage!=null)<br>{<br>showpage=Integer.parseInt(topage);<br>if(showpage>pagecount){<br>showpage=pagecount;<br>}elseif(showpage<=0){<br>showpage=1;<br>}<br>}<br>rs.absolute((showpage-1)*pagesize+1);<br>for(inti=1;i<=pagesize;i++)<br>{<br>code=rs.getInt("id");<br>%><br><tr><br><tdwidth="17%"align="center"height="27"><%=code%></td><br><tdwidth="17%"align="center"height="27"><%=rs.getString("username")%></td><br><tdwidth="17%"align="center"height="27"><%=rs.getString("logrole")%></td><br><tdwidth="18%"align="center"height="27"><%=rs.getString("addtime")%></td><br><tdwidth="17%"align="center"height="27"><ahref="Userdel?id=<%=code%>"onclick="returncheck_delete();">删除</a></td><br></tr>//删除功能<br><%<br>if(!rs.next())<br>break;<br>}}<br>}catch(Exceptione)<br>{out.println("查询异常!!!");}<br>%><br><tr><br><tdwidth="786"height="30"colspan="9"align="right"><br><tablewidth="786"align="center"cellpadding="0"cellspacing="0"><br><tr><br><tdwidth="786"height="30"colspan="6"align="right"><br><divalign="center">共<%=pagecount%>页<br><ahref="admincontrol.jsp?topage=<%=1%>">第一页</a><br><ahref="admincontrol.jsp?topage=<%=showpage-1%>">上一页</a><br><ahref="admincontrol.jsp?topage=<%=showpage+1%>">下一页</a><br><ahref="admincontrol.jsp?topage=<%=pagecount%>">最后一页</a><br></div><br></td><br></tr><br></table><br></td><br></tr><br></form><br></table><br></body><br></html>
- 2021-02-11 13:55:09
- 至深科技
- 急JSP 的源代码,哪有用JSP就能完成注册和登录的,这需要和数据库连接的,也就需要用到java语言了。如果说页面<%@page contentType="text/html;charset=GBK"%><html><head> <title> login student html </title></head><body><p align="center" style="color:red;font-size:19pt">登陆界面</p><hr><form action="/QQStudent/action/login" method="post"><table border="1"><tr><td>userName:</td><td><input type="text" name="userName"></input></td></tr><tr><td>Password:</td><td><input type="password" name="password"></input></td></tr></table><span><input type="submit" name="submit" value="登录"></input><input type="reset" name="reset" value="取消"></input></span></form> </body></html>这个就可以了!!
- 2021-02-11 13:55:09