jspÐÂÊÖ,Çë½Ì¸÷λ? - Java / Web ¿ª·¢
³ÌÐòÈçÏÂ:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page language="java" %>
<%@ page import="com.mysql.jdbc.Driver" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<title>title</title>
</head>
<body>
<%
//Çý¶¯³ÌÐòÃû
String driverName="com.mysql.jdbc.Driver";
//Êý¾Ý¿âÓû§Ãû
String username="root";
//ÃÜÂë
String password="*******";
//Êý¾Ý¿âÃû
String dbName="study";
//±íÃû
String tableName="product";
//Á¬½Ó×Ö·û´®
String url="jdbc:mysql://localhost/"+dbName+"?characterEncoding=GBK";
try{
//¼ÓÔØÇý¶¯³ÌÐò
Class.forName("com.mysql.jdbc.Driver");
//½¨Á¢Í¬Êý¾Ý¿âµÄÁ¬½Ó¶ÔÏó
Connection connection=DriverManager.getConnection(url,username,password);
Statement statement = connection.createStatement();
String sql="SELECT * from "+tableName;
//·¢ËÍÒªÖ´ÐеÄSQLÓï¾ä
ResultSet rs = statement.executeQuery(sql);
out.print("Êý¾Ý¿âÁ¬½Ó³É¹¦<BR>");
while(rs.next())
{
out.print(rs.getint(1));
out.print(rs.getString("pdm"));
out.print(rs.getString("pname
Ïà¹ØÎÊ´ð£º
ÎÒJSPµÄÒ³ÃæÊÇ£º
<%@ page language="java" contentType="text/html; charset=gb2312"
%>
<script>
function Save(){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==nul ......
ÌâÄ¿£º
ÓÐ1,2,3£¬4,5,6Áù¸öÊý×ÖÅÅÐò£¬ÓÃjava³ÌÐò¼ÆËã³öÅÅÐòµÄÖÖÀà¡£
ÒªÇó£ºÒ»£¬ÒÔ4¿ªÍ·
¶þ£¬2,3²»ÄÜÏàÁÚ
Èý£¬²»ÄÜÒÔ5¿ªÍ·
Ï£Íû´ó¼ÒÄܼ´ ......
ÇëÎʸ÷λ¸ç¸ç½ã½ã£¬ÈçºÎÔËÓÃÏֳɵÄÄ£°åÀ´ÖÆ×÷ƯÁÁµÄJSPÍøҳѽ,»ØÕßÓзÖ!
×Ô¼º¶¥Ï£¬×ÜÓиßÊÖ°É,ÆÚ´ýÖÐ......
Èç¹ûÖ±½ÓÒýÓýøÈ¥
¿ÉÒÔÖ±½ÓÓÃjspµÄÖ¸ÁҲ¿ÉÒÔÓÃfreemarkÒýÓ㬼ǵøø·Ö
лл¸÷λÁË£¬¿´À´Î ......
ʹÓÃjavaÔÚwindows7 32λÏÂÁ¬½ÓMSSQL¡£
Á½Ì¨»úÆ÷£¬windows7 32룬ÔÚ¿ØÖÆÃæ°åÀïÃæÈ«²¿ÉèÖÃÓïÑÔºÍÇøÓòÑ¡Ïenglish-unitedstates
ΨһÇø±ðÖ»ÓÐÔÚ°²×°SQL server 2008µÄʱºò Ñ¡ÔñµÄ×Ö·û¼¯²»Ò»Ñù£¬
exec sp_helpsor ......
insert into [ScholarshipManagement].[dbo].[department] ([department],[specialization] ,[grade]) output inserted.departmentID values(? ,? ,? )
ÇëÎÊ´ó¸çÃÇÕâ¸ösql Óï¾äÓ¦¸ÃÓÃJavaÀïµÄÄǸöÊý¾Ý¿â²Ù×÷·½·¨£¿ ......