jspÁ¬½ÓÊý¾Ý¿âʾÀý
1£¬Ð½¨Ò»web¹¤³Ì£¬½«Êý¾Ý¿âÁ¬½Ó°üÌí¼ÓÈëlibÎļþ¼ÐÏ¡£
2£¬Ð½¨jspÒ³Ãæ£¬ÄÚÈÝÈçÏ£º
<%@ page language="java" import="java.util.*" import="java.sql.*" pageEncoding="gb2312"%>
<%
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>jspÁ¬½ÓÊý¾Ý¿â</title>
</head>
<body>
This is my JSP page. <br>
<%
// Çý¶¯³ÌÐòÃû
String driver = "com.mysql.jdbc.Driver";
// URLÖ¸ÏòÒª·ÃÎʵÄÊý¾Ý¿âÃûscutcs
String url = "jdbc:mysql://192.168.10.43:3306/clientmanager";
// MySQLÅäÖÃʱµÄÓû§Ãû
String user = "root";
// MySQLÅäÖÃʱµÄÃÜÂë
String password = "123";
try {
// ¼ÓÔØÇý¶¯³ÌÐò
Class.forName(driver);
// Á¬ÐøÊý¾Ý¿â
Connection conn = DriverManager.getConnection(url, user, password);
if (!conn.isClosed())
System.out.println("Succeeded connecting to the Database!");
// statementÓÃÀ´Ö´ÐÐSQLÓï¾ä
Statement statement = conn.createStatement();
// ÒªÖ´ÐеÄSQLÓï¾ä
String sql = "select * from tb_hotel";
// ½á¹û¼¯
ResultSet rs = statement.executeQuery(sql);
System.out.println("-----------------");
System.out.println("Ö´Ðнá¹ûÈçÏÂËùʾ:");
System.out.println("-----------------");
String name = null;
while (rs.next()) {
// Ñ¡Ôñhotel_nameÕâÁÐÊý¾Ý
name = rs.getString("hotel_name");
// Êä³ö½á¹û
System.out.println("¾ÆµêÃû£º" + "\t" + name);
}
rs.close();
conn.close();
Ïà¹ØÎĵµ£º
JSPÄÚ½¨¶ÔÏó- -
¢Ù out - javax.servlet.jsp.jspWriter
out¶Ô ......
Perl¡¢PHP¡¢ASP¡¢JSP¼¼Êõ±È½Ï
±¾ÎĽ«¶ÔĿǰ×î³£ÓõÄËÄÖÖ¶¯Ì¬ÍøÒ³ÓïÑÔPerl£¨Practical Extraction and Report Language£©¡¢PHP£¨Hypertext Preprocessor£©¡¢ASP£¨Active Server Pages£©¡¢JSP£¨JavaServer Pages£©½øÐÐһЩ¼¼ÊõÐԵıȽϡ£
¡¡¡¡Perl
¡¡¡¡Perl£¨Practical Extraction and Report Language£©ÊÇÒ»ÖֺܹÅÀϵĽű ......
response.setContentType( "application/pdf" ); // MIME type for pdf doc
response.setHeader("Content-Disposition","attachment;filename=output.pdf;");
Sets the Content-Type header. Content-Type identifies the MIME type of the response document and the character set encoding.
To se ......
Á·ÇÙµÄʱºò°ÑRIFF½Ð×öÒ»¸öÇú×ÓµÄСƬ¶Î£¬ÄÇôÎÒ×Ô¼º¶¨ÒåһϳÌÐòµÄRIFF¾ÍÊÇһС¶Î³ÌÐò°É£¬·ÅһЩÕ⼸Ìì×Ô¼ºÐ´µÄ£¬ÒÔºóÒ²³¤ÆÚ¸üУ¬×÷Ϊ×Ô¼º»ýÀۺͽñºó±à³ÌµÄ²Î¿¼¡£
1. ¸ñʽ»¯ÍøÖ·£¬ÈôûÓÐHTTPÍ·Ôò²åÈëHTTPÍ·
<?php
//add http head to url
function AddHttpHead( &$s )
{
$exist = strstr( $s,"http://" ......