标签:html str exception table nec login ons sea tco
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <form method="post" action="dologin.jsp"> 用户名:<input type="text" name="name"/> <br><br><br> 密 码:<input type="text" name="password"/><br> <hr> <input type="submit" value="登录"> </form> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ page import="scc.Userdao" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <% String name=request.getParameter("name"); String password=request.getParameter("password"); Userdao dao=new Userdao(); if(dao.select(name, password)){ request.getRequestDispatcher("main.jsp").forward(request, response); }else{ response.sendRedirect("login.jsp"); } %> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@page import="java.sql.*" %> <%@page import="scc.JDBCUtils" %> <%@page import="scc.Msg" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <% String nn=request.getParameter("name"); %> <% Connection con=null; PreparedStatement st=null; ResultSet rst=null; try{ con=JDBCUtils.getCon(); String sql="select*from msg where sender=?"; st=con.prepareStatement(sql); st.setString(1, nn); rst=st.executeQuery(); Msg m=new Msg(); %> <table border="1" > <tr> <td> 标题</td> <td> 内容</td> <td> 发件人</td> <td>收件人</td> <td> 日期</td> <td> 状态</td> </tr> <% while(rst.next()){ %> <tr> <td> <%=rst.getString("title") %></td> <td> <%=rst.getString("content") %></td> <td> <%=rst.getString("sender") %></td> <td><%=rst.getString("recive") %></td> <td> <%=rst.getString("date") %></td> <td> <%=rst.getString("state") %></td> </tr> <%} %> </table> <% }catch(Exception e){ throw new RuntimeException(e); } finally{ JDBCUtils.closeAll(rst, st, con); } %> <br> <br> <br> <br> <br> <br> <div > <form action="domain.jsp" method="post"> 请输入你的标题 <input type="text" name="tt"> <input type="submit" value="搜索标题"> </form> </div> </body> </html>
标签:html str exception table nec login ons sea tco
原文地址:https://www.cnblogs.com/gsfwxj1820/p/12800242.html