作为.net程序员学jsp,伤不起

来源:互联网 发布:松锦大战 知乎 编辑:程序博客网 时间:2024/04/29 11:15


<%@page import="java.sql.*"%>
<%@ 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>
<base href="<%=basePath%>">


<title>My JSP 'dbexample1.jsp' starting page</title>


<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->


</head>
<body>


<%
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/phpcms", "root", "");
Statement statement = connection.createStatement();
ResultSet rs = statement
.executeQuery("select email from v9_admin where username='phpcms'");
while (rs.next()) {
out.println(rs.getString(1));
%>
<br>
<% } %>
























</body>
</html>
0 0
原创粉丝点击