- <%--
- Document : newjsp
- Created on : 2010-11-3, 11:16:08
- Author : yuchao
- --%>
- <%@ page import = "com.bocom.netpay.b2cAPI.*"%>
- <%@ page import = "java.io.*" %>
- <%@ page import = "java.util.*" %>
- <%@ page import = "java.sql.*" %>
- s
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "<a href="http://www.w3.org/TR/html4/loose.dtd">http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>JSP Page</title>
- </head>
- <body>
- <h1>Hello World!</h1>
- <h1>YuChao</h1>
- <%--
- <%
- String param = request.getParameter("yu");
- %>
- <h1>yu=<%=param%></h1>
- <%
- Cookie[] mycookie = request.getCookies();
- for (int i=0;i<mycookie.length;i++)
- {
- %>
- <b>COOKIE NAME:</b>
- <%=mycookie[i].getName()%>
- <b>COOKIE VALUE:</b>
- <%=mycookie[i].getValue()%>
- <b>COOKIE MAX:</b>
- <%=mycookie[i].getMaxAge()%>
- <b>set COOKIE MAX:</b>
- <%mycookie[i].setMaxAge(60);%>
- <%=mycookie[i].getMaxAge()%>
- <% } %>
- <jsp:forward page="merchant.jsp" />
- <jsp:forward page="BallanceQuery.jsp" />
- <jsp:forward page="Batchorderquery.jsp" />
- <jsp:forward page="Currentorderquery.jsp" />
- <jsp:forward page="DownloadSettlement.jsp" />
- <jsp:forward page="Historyorderquery.jsp" />
- <jsp:forward page="QueryRefund.jsp" />
- <jsp:forward page="Refund.jsp" />
- <jsp:forward page="VerifyID.jsp" />
- <jsp:forward page="merchant_result.jsp"/>
- <jsp:forward page="merchant_result_vip.jsp" />
- <jsp:forward page="preOrder.jsp" />
- <jsp:forward page="index.jsp" />
- <jsp:forward page="descript.jsp" />
- --%>
- <%
- try{
- Class.forName("com.mysql.jdbc.Driver");
- out.println("yuchao");
- DriverManager.registerDriver(new com.mysql.jdbc.Driver());
- String dbURL="jdbc:<a href="mysql://localhost:3306/test">mysql://localhost:3306/test";
- String dbUser = "root";
- String dbPwd = "";
- out.println(dbUser);
- Connection con = java.sql.DriverManager.getConnection(dbURL,dbUser,dbPwd);
- Statement stmt = con.createStatement();
- stmt.executeUpdate("INSERT INTO orderx(gate_bill) VALUES(123456789)");
- ResultSet rs = stmt.executeQuery("SELECT * FROM orderx");
- out.println("<table border=1 width=400>");
- while(rs.next())
- {
- String col1 = rs.getString(1);
- String col2 = rs.getString(2);
- String col3 = rs.getString(5);
- String col4 = rs.getString(6);
- out.println("<tr><td>"+col1+"</td><td>"+col2+
- "</td><td>"+col3+"</td><td>"+col4+"</td></tr>");
- }
- out.println("</table>");
- rs.close();
- stmt.close();
- con.close();
- }
- catch(Exception e){
- out.println(e.getMessage());}
- %>
- </body>
- </html>
- //该片段来自于http://www.codesnippet.cn/detail/080520133193.html
来源: http://www.codesnippet.cn/detail/080520133193.html