﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-aslucky</title><link>http://www.cppblog.com/aslucky/</link><description>C++</description><language>zh-cn</language><lastBuildDate>Tue, 14 Apr 2026 23:08:36 GMT</lastBuildDate><pubDate>Tue, 14 Apr 2026 23:08:36 GMT</pubDate><ttl>60</ttl><item><title>jsp数据库连接大全和数据库操作封装到Javabean  转帖 备查</title><link>http://www.cppblog.com/aslucky/archive/2008/10/14/63957.html</link><dc:creator>aslucky</dc:creator><author>aslucky</author><pubDate>Tue, 14 Oct 2008 06:40:00 GMT</pubDate><guid>http://www.cppblog.com/aslucky/archive/2008/10/14/63957.html</guid><wfw:comment>http://www.cppblog.com/aslucky/comments/63957.html</wfw:comment><comments>http://www.cppblog.com/aslucky/archive/2008/10/14/63957.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/aslucky/comments/commentRss/63957.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/aslucky/services/trackbacks/63957.html</trackback:ping><description><![CDATA[<h2><a id=viewpost1_TitleUrl href="http://www.blogjava.net/wujun/archive/2006/04/26/43429.html"><u><font color=#810081>jsp数据库连接大全和数据库操作封装到Javabean</font></u></a> </h2>
<div class=postText><strong><font size=4>
<p align=right><font size=4></font><font color=#333333>来源</font> <font color=#333333>： http://blog.csdn.net/cm4ever/</font> </p>
<br>一、jsp连接Oracle8/8i/9i数据库（用thin模式）<br></font></strong>testOracle.jsp如下：
<table width=0% border=1>
    <tbody>
        <tr>
            <td vAlign=top>
            <p style="FONT-SIZE: 9pt"><font color=#993300>&lt;%</font>@ page <font color=#0000ff>contentType</font>=<font color=#999999>"text/html;charset=gb2312"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font>@ page <font color=#0000ff>import</font>=<font color=#999999>"java.sql.*"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> result = ""; <font color=#009900>// 查询结果字符串</font><br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> sql = <font color=#999999>"select * from test"</font>; <font color=#009900>// SQL 字符串</font><br><br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 连接字符串，格式： "jdbc:数据库驱动名称:连接模式:@数据库服务器ip:端口号:数据库SID"</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> url = <font color=#999999>"jdbc:oracle:thin:@localhost:1521:orcl"</font>;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> username = <font color=#999999>"scott"</font>; <font color=#009900>// 用户名</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> password = <font color=#999999>"tiger"</font>; <font color=#009900>//密码</font><br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#009900>// 创建oracle数据库驱动实例</font><br><font color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;Class</font>.<font color=#ff9900>forName</font>(<font color=#999999>"oracle.jdbc.driver.OracleDriver"</font>).<font color=#ff9900>newInstance</font>();<br><br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 获得与数据库的连接</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Connection</font> conn = <font color=#ff0000>DriverManager</font>.<font color=#ff9900>getConnection</font>(url, username, password);&nbsp;<br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 创建执行语句对象</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Statement</font>&nbsp;&nbsp;stmt = conn.<font color=#ff9900>createStatement</font>();<br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 执行sql语句，返回结果集</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>ResultSet</font>&nbsp; rs&nbsp;&nbsp; = stmt.<font color=#ff9900>executeQuery</font>(sql);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#0000ff>while</font> ( rs.<font color=#ff9900>next</font>() ) <br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result += <font color=#999999>"\n 第一个字段内容："</font> + rs.<font color=#ff9900>getString</font>(1) + <font color=#999999>"&lt;BR&gt;"</font>;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;rs.<font color=#ff9900>close</font>();&nbsp;<font color=#009900>// 关闭结果集</font><br>&nbsp;&nbsp;&nbsp;&nbsp;stmt.<font color=#ff9900>close</font>(); <font color=#009900>// 关闭执行语句对象</font><br>&nbsp;&nbsp;&nbsp;&nbsp;conn.<font color=#ff9900>close</font>(); <font color=#009900>// 关闭与数据库的连接</font><br><font color=#993300>%&gt;</font><br><br><font color=#0000ff>&lt;HTML&gt;<br>&lt;BODY&gt;</font><br><font color=#0000ff>&nbsp;&nbsp;</font><font color=#993300>&lt;%</font>=result<font color=#993300>%&gt;</font><font color=#0000ff><br>&lt;/BODY&gt;<br>&lt;/HTML&gt;</font></p>
            </td>
        </tr>
    </tbody>
</table>
<br><font size=+1><strong>二、jsp连接Sql Server7.0/2000数据库</strong></font><br>testSqlServer.jsp如下
<table width=0% border=1>
    <tbody>
        <tr>
            <td vAlign=top>
            <p style="FONT-SIZE: 9pt"><font color=#993300>&lt;%</font>@ page <font color=#0000ff>contentType</font>=<font color=#999999>"text/html;charset=gb2312"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font>@ page <font color=#0000ff>import</font>=<font color=#999999>"java.sql.*"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> sql = <font color=#999999>"select * from test"</font>;<br><br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 连接字符串，格式： "jdbc:公司名称:数据库驱动名称://数据库服务器ip:端口号;DatabaseName=数据库名称"</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> url = <font color=#999999>"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs"</font>;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> username = <font color=#999999>"scott"</font>;<font color=#ff0000><br>&nbsp;&nbsp;&nbsp;&nbsp;String</font> password = <font color=#999999>"tiger"</font>;<br><br><font color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;Class</font>.<font color=#ff9900>forName</font>(<font color=#999999>"com.microsoft.jdbc.sqlserver.SQLServerDriver"</font>).<font color=#ff9900>newInstance</font>();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Connection</font> conn = <font color=#ff0000>DriverManager</font>.<font color=#ff9900>getConnection</font>(url, username, password);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Statement</font>&nbsp;&nbsp;stmt = conn.<font color=#ff9900>createStatement</font>(<font color=#ff0000>ResultSet</font>.TYPE_SCROLL_SENSITIVE, <font color=#ff0000>ResultSet</font>.CONCUR_UPDATABLE);<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>ResultSet</font>&nbsp; rs&nbsp;&nbsp; = stmt.<font color=#ff9900>executeQuery</font>(sql);<br><br><font color=#993300>%&gt;</font><br><br><font color=#0000ff>&lt;HTML&gt;<br>&lt;BODY&gt;</font><br><br><font color=#993300>&lt;% </font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#0000ff>while</font> ( rs.<font color=#ff9900>next</font>() ) <br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#993300>%&gt;</font><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第一个字段内容为：<font color=#993300>&lt;%=</font>rs.<font color=#ff9900>getStrisng</font>(1)<font color=#993300>%&gt;</font><font color=#0000ff>&lt;BR&gt;</font><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#993300>&lt;%</font><br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;rs.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;stmt.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;conn.<font color=#ff9900>close</font>();<br><font color=#993300>%&gt;</font><br><font color=#0000ff><br>&lt;/BODY&gt;<br>&lt;/HTML&gt;</font></p>
            </td>
        </tr>
    </tbody>
</table>
<br><font size=+1><strong>三、jsp连接DB2数据库</strong></font><br>testDB2.jsp如下：<br>
<table width=0% border=1>
    <tbody>
        <tr>
            <td vAlign=top>
            <p style="FONT-SIZE: 9pt"><font color=#993300>&lt;%</font>@ page <font color=#0000ff>contentType</font>=<font color=#999999>"text/html;charset=gb2312"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font>@ page <font color=#0000ff>import</font>=<font color=#999999>"java.sql.*"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> sql = <font color=#999999>"select * from test"</font>;<br><br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 连接字符串，格式： "jdbc:数据库驱动名称://数据库服务器ip:端口号/数据库名称"</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> url = <font color=#999999>"jdbc:db2://localhost:5000/sample"</font>;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> username = <font color=#999999>"scott"</font>;<font color=#ff0000><br>&nbsp;&nbsp;&nbsp;&nbsp;String</font> password = <font color=#999999>"tiger"</font>;<br><br><font color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;Class</font>.<font color=#ff9900>forName</font>(<font color=#999999>"com.ibm.db2.jdbc.app.DB2Driver"</font>).<font color=#ff9900>newInstance</font>();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Connection</font> conn = <font color=#ff0000>DriverManager</font>.<font color=#ff9900>getConnection</font>(url, username, password);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Statement</font>&nbsp;&nbsp;stmt = conn.<font color=#ff9900>createStatement</font>(<font color=#ff0000>ResultSet</font>.TYPE_SCROLL_SENSITIVE, <font color=#ff0000>ResultSet</font>.CONCUR_UPDATABLE);<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>ResultSet</font>&nbsp; rs&nbsp;&nbsp; = stmt.<font color=#ff9900>executeQuery</font>(sql);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;rs.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;stmt.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;conn.<font color=#ff9900>close</font>();<br><font color=#993300>%&gt;</font></p>
            </td>
        </tr>
    </tbody>
</table>
<br><font size=+1><strong>四、jsp连接Informix数据库 </strong></font><br>testInformix.jsp如下：<br>
<table width=0% border=1>
    <tbody>
        <tr>
            <td vAlign=top>
            <p style="FONT-SIZE: 9pt"><font color=#993300>&lt;%</font>@ page <font color=#0000ff>contentType</font>=<font color=#999999>"text/html;charset=gb2312"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font>@ page <font color=#0000ff>import</font>=<font color=#999999>"java.sql.*"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> sql = <font color=#999999>"select * from test"</font>;<br><br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 连接字符串，格式： "jdbc:数据库驱动名称://数据库服务器ip:端口号/数据库名称:INFORMIXSERVER=服务器名;user=用户名;password=</font><font color=#009900>密码"</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> url = <font color=#999999>"jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver;user=testuser;password=testpassword"</font>;<br><br><font color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;Class</font>.<font color=#ff9900>forName</font>(<font color=#999999>"com.informix.jdbc.IfxDriver"</font>).<font color=#ff9900>newInstance</font>();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Connection</font> conn = <font color=#ff0000>DriverManager</font>.<font color=#ff9900>getConnection</font>(url);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Statement</font>&nbsp;&nbsp;stmt = conn.<font color=#ff9900>createStatement</font>(<font color=#ff0000>ResultSet</font>.TYPE_SCROLL_SENSITIVE, <font color=#ff0000>ResultSet</font>.CONCUR_UPDATABLE);<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>ResultSet</font>&nbsp; rs&nbsp;&nbsp; = stmt.<font color=#ff9900>executeQuery</font>(sql);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;rs.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;stmt.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;conn.<font color=#ff9900>close</font>();<br><font color=#993300>%&gt;</font></p>
            </td>
        </tr>
    </tbody>
</table>
<br><strong><font size=+1>五、jsp连接Sybase数据库 <br></font></strong>testSybase.jsp如下：
<table width=0% border=1>
    <tbody>
        <tr>
            <td vAlign=top>
            <p style="FONT-SIZE: 9pt"><font color=#993300>&lt;%</font>@ page <font color=#0000ff>contentType</font>=<font color=#999999>"text/html;charset=gb2312"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font>@ page <font color=#0000ff>import</font>=<font color=#999999>"java.sql.*"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> sql = <font color=#999999>"select * from test"</font>;<br><br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 连接字符串，格式： "jdbc:公司名称:数据库驱动名称:数据库服务器ip:端口号/数据库名称"</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> url = <font color=#999999>"jdbc:sybase:Tds:localhost:5007/tsdata"</font>;<br><br><font color=#ff0000>Properties</font> prop = <font color=#ff0000>System</font>.<font color=#ff9900>getProperties</font>();<br>prop.<font color=#ff9900>put</font>(<font color=#999999>"user"</font>, <font color=#999999>"userid"</font>); <font color=#009900>// 用户名</font><br>prop.<font color=#ff9900>put</font>(<font color=#999999>"password"</font>,&nbsp;<font color=#999999>"user_password"</font>); <font color=#009900>// 密码</font><br><br><font color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;Class</font>.<font color=#ff9900>forName</font>(<font color=#999999>"com.sybase.jdbc.SybDriver"</font>).<font color=#ff9900>newInstance</font>();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Connection</font> conn = <font color=#ff0000>DriverManager</font>.<font color=#ff9900>getConnection</font>(url, prop);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Statement</font>&nbsp;&nbsp;stmt = conn.<font color=#ff9900>createStatement</font>(<font color=#ff0000>ResultSet</font>.TYPE_SCROLL_SENSITIVE, <font color=#ff0000>ResultSet</font>.CONCUR_UPDATABLE);<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>ResultSet</font>&nbsp; rs&nbsp;&nbsp; = stmt.<font color=#ff9900>executeQuery</font>(sql);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;rs.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;stmt.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;conn.<font color=#ff9900>close</font>();<br><font color=#993300>%&gt;</font></p>
            </td>
        </tr>
    </tbody>
</table>
<br><font size=+1><strong>六、jsp连接MySQL数据库 </strong></font><br>testMySQL.jsp如下：
<table width=0% border=1>
    <tbody>
        <tr>
            <td vAlign=top height=304>
            <p style="FONT-SIZE: 9pt"><font color=#993300>&lt;%</font>@ page <font color=#0000ff>contentType</font>=<font color=#999999>"text/html;charset=gb2312"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font>@ page <font color=#0000ff>import</font>=<font color=#999999>"java.sql.*"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> sql = <font color=#999999>"select * from test"</font>;<br><br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 连接字符串，格式： "jdbc:数据库驱动名称://数据库服务器ip/数据库名称?user=用户名&amp;password=密码&amp;使用Unicode=布尔值&amp;字符编码=编码"</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> url = <font color=#999999>"jdbc:mysql://localhost/softforum?user=soft&amp;password=soft1234&amp;useUnicode=true&amp;characterEncoding=8859_1"</font>;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> username = <font color=#999999>"scott"</font>;<font color=#ff0000><br>&nbsp;&nbsp;&nbsp;&nbsp;String</font> password = <font color=#999999>"tiger"</font>;<br><br><font color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;Class</font>.<font color=#ff9900>forName</font>(<font color=#999999>"org.gjt.mm.mysql.Driver"</font>).<font color=#ff9900>newInstance</font>();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Connection</font> conn = <font color=#ff0000>DriverManager</font>.<font color=#ff9900>getConnection</font>(url, username, password);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Statement</font>&nbsp;&nbsp;stmt = conn.<font color=#ff9900>createStatement</font>(<font color=#ff0000>ResultSet</font>.TYPE_SCROLL_SENSITIVE, <font color=#ff0000>ResultSet</font>.CONCUR_UPDATABLE);<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>ResultSet</font>&nbsp; rs&nbsp;&nbsp; = stmt.<font color=#ff9900>executeQuery</font>(sql);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;rs.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;stmt.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;conn.<font color=#ff9900>close</font>();<br><font color=#993300>%&gt;</font></p>
            </td>
        </tr>
    </tbody>
</table>
<br><strong><font size=+1>七、jsp连接PostgreSQL数据库</font></strong><br>testPostgreSQL.jsp如下：
<table width=0% border=1>
    <tbody>
        <tr>
            <td vAlign=top height=304>
            <p style="FONT-SIZE: 9pt"><font color=#993300>&lt;%</font>@ page <font color=#0000ff>contentType</font>=<font color=#999999>"text/html;charset=gb2312"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font>@ page <font color=#0000ff>import</font>=<font color=#999999>"java.sql.*"</font><font color=#993300>%&gt;</font><br><font color=#993300>&lt;%</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> sql = <font color=#999999>"select * from test"</font>;<br><br><font color=#009900>&nbsp;&nbsp;&nbsp;&nbsp;// 连接字符串，格式： "jdbc:数据库驱动名称://数据库服务器ip/数据库名称"</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> url = <font color=#999999>"jdbc:postgresql://localhost/soft"</font>;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>String</font> username = <font color=#999999>"scott"</font>;<font color=#ff0000><br>&nbsp;&nbsp;&nbsp;&nbsp;String</font> password = <font color=#999999>"tiger"</font>;<br><br><font color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;Class</font>.<font color=#ff9900>forName</font>(<font color=#999999>""org.postgresql.Driver"</font>).<font color=#ff9900>newInstance</font>();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Connection</font> conn = <font color=#ff0000>DriverManager</font>.<font color=#ff9900>getConnection</font>(url, username, password);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>Statement</font>&nbsp;&nbsp;stmt = conn.<font color=#ff9900>createStatement</font>(<font color=#ff0000>ResultSet</font>.TYPE_SCROLL_SENSITIVE, <font color=#ff0000>ResultSet</font>.CONCUR_UPDATABLE);<br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>ResultSet</font>&nbsp; rs&nbsp;&nbsp; = stmt.<font color=#ff9900>executeQuery</font>(sql);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;rs.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;stmt.<font color=#ff9900>close</font>();<br>&nbsp;&nbsp;&nbsp;&nbsp;conn.<font color=#ff9900>close</font>();<br><font color=#993300>%&gt;</font></p>
            </td>
        </tr>
    </tbody>
</table>
<table height=146 cellSpacing=0 cellPadding=0 width=684 align=center border=0>
    <tbody>
        <tr>
            <td class=ArticleTeitle vAlign=top height=35>
            <p>下面是简单的数据库操作Javabean的代码:</p>
            <table border=1>
                <tbody>
                    <tr>
                        <td width=657>DbWrapper.java</td>
                    </tr>
                    <tr>
                        <td>
                        <pre><tt><span class=style2><span class=style3><strong><font color=#000080>import</font></strong> java<font color=#990000>.</font>sql<font color=#990000>.*;</font><strong><font color=#000080>import</font></strong> java<font color=#990000>.</font>util<font color=#990000>.*;</font><strong><font color=#0000ff>public</font></strong><strong><font color=#0000ff>class</font></strong> DbWrapper
                        <font color=#ff0000>{</font><em><font color=#9a1900>// 定义连接池对象为静态变量，将一直存在，直到工作目录关闭。</font></em><strong><font color=#0000ff>private</font></strong><strong><font color=#0000ff>static</font></strong> DataSource ds <font color=#990000>=</font><strong><font color=#0000ff>null</font></strong><font color=#990000>;</font><br><em><font color=#9a1900>// 1.用连接池的方式获得连接</font></em><em><font color=#9a1900>// 如果不是做多数据库程序，推荐使用此方法</font></em><em><font color=#9a1900>// 相关内容：<a href="http://blog.csdn.net/cm4ever/archive/2004/10/22/147446.aspx" target=_blank><u><font color=#0000ff>在tomcat管理界面配置连接池</font></u></a></font></em><font color=#0000ff><strong>public</strong><strong>static</strong></font> Connection <strong><font color=#000000>openConnection</font></strong><font color=#990000>()</font><strong><font color=#0000ff>throws</font></strong> Exception
                        <font color=#ff0000>{</font><em><font color=#9a1900>// 只需要初始化1次</font></em><strong><font color=#0000ff>if</font></strong><font color=#990000>(</font> ds <font color=#990000>==</font><strong><font color=#0000ff>null</font></strong><font color=#990000>)</font><font color=#ff0000>{</font>
                        Context initContext <font color=#990000>=</font><strong><font color=#0000ff>new</font></strong><strong><font color=#000000>InitialContext</font></strong><font color=#990000>();</font>
                        Context envContext <font color=#990000>=</font><font color=#990000>(</font>Context<font color=#990000>)</font> initContext<font color=#990000>.</font><strong><font color=#000000>lookup</font></strong><font color=#990000>(</font><font color=#ff0000>"java:/comp/env"</font><font color=#990000>);</font>
                        DataSource ds <font color=#990000>=</font><font color=#990000>(</font>DataSource<font color=#990000>)</font> envContext<font color=#990000>.</font><strong><font color=#000000>lookup</font></strong><font color=#990000>(</font><font color=#ff0000>"jdbc/MyDataSource"</font><font color=#990000>);</font><font color=#ff0000>}</font><strong><font color=#0000ff>return</font></strong> ds<font color=#990000>.</font><strong><font color=#000000>getConnection</font></strong><font color=#990000>();</font><font color=#ff0000>}</font><em><font color=#9a1900>// 2.用jdbc驱动获得连接</font></em><em><font color=#9a1900>// 相关内容：<a href="http://blog.csdn.net/cm4ever/archive/2004/09/30/121770.aspx" target=_blank><u><font color=#0000ff>JSP数据库连接大全</font></u></a></font></em><font color=#0000ff><strong>public</strong><strong>static</strong></font> Connection <strong><font color=#000000>openConnection</font></strong><font color=#990000>(</font>
                        String driver<font color=#990000>,</font>
                        String url<font color=#990000>,</font>
                        String username<font color=#990000>,</font>
                        String password<font color=#990000>)</font><strong><font color=#0000ff>throws</font></strong> Exception
                        <font color=#ff0000>{</font>
                        Class<font color=#990000>.</font><strong><font color=#000000>forName</font></strong><font color=#990000>(</font>driver<font color=#990000>).</font><strong><font color=#000000>newInstance</font></strong><font color=#990000>();</font><strong><font color=#0000ff>return</font></strong> DriverManager<font color=#990000>.</font><strong><font color=#000000>getConnection</font></strong><font color=#990000>(</font>url<font color=#990000>,</font> username<font color=#990000>,</font> password<font color=#990000>);</font><font color=#ff0000>}</font><strong><font color=#0000ff>public</font></strong><strong><font color=#0000ff>static</font></strong><font color=#009900>void</font><strong><font color=#000000>closeConnection</font></strong><font color=#990000>(</font>Connection conn<font color=#990000>)</font><strong><font color=#0000ff>throws</font></strong> Exception
                        <font color=#ff0000>{</font><strong><font color=#0000ff>if</font></strong><font color=#990000>(</font> conn <font color=#990000>!=</font><strong><font color=#0000ff>null</font></strong><font color=#990000>)</font><font color=#ff0000>{</font>
                        conn<font color=#990000>.</font><strong><font color=#000000>close</font></strong><font color=#990000>();</font><font color=#ff0000>}</font><font color=#ff0000>}<br></font><strong><font color=#0000ff>public</font></strong><strong><font color=#0000ff>static</font></strong><font color=#009900>int</font><strong><font color=#000000>executeUpdate</font></strong><font color=#990000>(</font>String sql<font color=#990000>)</font><strong><font color=#0000ff>throws</font></strong> Exception
                        <font color=#ff0000>{</font><font color=#009900>int</font> count <font color=#990000>=</font><font color=#993399>0</font><font color=#990000>;</font>
                        Connection conn <font color=#990000>=</font><strong><font color=#0000ff>null</font></strong><font color=#990000>;</font>
                        Statement  stmt <font color=#990000>=</font><strong><font color=#0000ff>null</font></strong><font color=#990000>;</font><strong><font color=#0000ff>try</font></strong><font color=#ff0000>{</font>
                        conn <font color=#990000>=</font><strong><font color=#000000>openConnection</font></strong><font color=#990000>();</font>
                        stmt <font color=#990000>=</font> conn<font color=#990000>.</font><strong><font color=#000000>createStatement</font></strong><font color=#990000>();</font>
                        count <font color=#990000>=</font> stmt<font color=#990000>.</font><strong><font color=#000000>executeUpdate</font></strong><font color=#990000>(</font>sql<font color=#990000>);</font><font color=#ff0000>}</font><strong><font color=#0000ff>catch</font></strong><font color=#990000>(</font> Exception e <font color=#990000>)</font><font color=#ff0000>{</font><strong><font color=#0000ff>throw</font></strong> e<font color=#990000>;</font><font color=#ff0000>}</font><strong><font color=#0000ff>finally</font></strong><font color=#ff0000>{</font><strong><font color=#000000>closeConnection</font></strong><font color=#990000>(</font>conn<font color=#990000>);</font><font color=#ff0000>}</font><strong><font color=#0000ff>return</font></strong> count<font color=#990000>;</font><font color=#ff0000>}</font><strong><font color=#0000ff>public</font></strong><strong><font color=#0000ff>static</font></strong> List <strong><font color=#000000>executeQuery</font></strong><font color=#990000>(</font>String sql<font color=#990000>)</font><strong><font color=#0000ff>throws</font></strong> Exception
                        <font color=#ff0000>{</font>
                        List list <font color=#990000>=</font><strong><font color=#0000ff>new</font></strong><strong><font color=#000000>ArrayList</font></strong><font color=#990000>();</font>
                        Connection conn <font color=#990000>=</font><strong><font color=#0000ff>null</font></strong><font color=#990000>;</font>
                        Statement  stmt <font color=#990000>=</font><strong><font color=#0000ff>null</font></strong><font color=#990000>;</font>
                        ResultSet  rs   <font color=#990000>=</font><strong><font color=#0000ff>null</font></strong><font color=#990000>;</font><strong><font color=#0000ff>try</font></strong><font color=#ff0000>{</font>
                        conn <font color=#990000>=</font><strong><font color=#000000>openConnection</font></strong><font color=#990000>();</font>
                        stmt <font color=#990000>=</font> conn<font color=#990000>.</font><strong><font color=#000000>createStatement</font></strong><font color=#990000>();</font>
                        rs   <font color=#990000>=</font> stmt<font color=#990000>.</font><strong><font color=#000000>executeQuery</font></strong><font color=#990000>(</font>sql<font color=#990000>);</font>
                        ResultSetMetaData rsmd <font color=#990000>=</font> rs<font color=#990000>.</font><strong><font color=#000000>getMetaData</font></strong><font color=#990000>();</font><strong><font color=#0000ff>while</font></strong><font color=#990000>(</font> rs<font color=#990000>.</font><strong><font color=#000000>next</font></strong><font color=#990000>()</font><font color=#990000>)</font><font color=#ff0000>{</font>
                        Map map <font color=#990000>=</font><strong><font color=#0000ff>new</font></strong><strong><font color=#000000>HashMap</font></strong><font color=#990000>();</font><strong><font color=#0000ff>for</font></strong><font color=#990000>(</font><font color=#009900>int</font> i <font color=#990000>=</font><font color=#993399>1</font><font color=#990000>;</font> i <font color=#990000>&lt;=</font> rsmd<font color=#990000>.</font><strong><font color=#000000>getColumnCount</font></strong><font color=#990000>();</font> i<font color=#990000>++</font><font color=#990000>)</font><font color=#ff0000>{</font>
                        map<font color=#990000>.</font><strong><font color=#000000>put</font></strong><font color=#990000>(</font>rsmd<font color=#990000>.</font><strong><font color=#000000>getColumnName</font></strong><font color=#990000>(</font>i<font color=#990000>),</font> rs<font color=#990000>.</font><strong><font color=#000000>getObject</font></strong><font color=#990000>(</font>i<font color=#990000>));</font><font color=#ff0000>}</font>
                        list<font color=#990000>.</font><strong><font color=#000000>add</font></strong><font color=#990000>(</font>map<font color=#990000>);</font><font color=#ff0000>}</font><br><font color=#ff0000>}</font><strong><font color=#0000ff>catch</font></strong><font color=#990000>(</font> Exception e <font color=#990000>)</font><font color=#ff0000>{</font>
                        e<font color=#990000>.</font><strong><font color=#000000>printStackTrace</font></strong><font color=#990000>();</font><font color=#ff0000>}</font><strong><font color=#0000ff>finally</font></strong><font color=#ff0000>{</font><strong><font color=#0000ff>if</font></strong><font color=#990000>(</font> rs <font color=#990000>!=</font><strong><font color=#0000ff>null</font></strong><font color=#990000>)</font> rs<font color=#990000>.</font><strong><font color=#000000>close</font></strong><font color=#990000>();</font><strong><font color=#000000>closeConnection</font></strong><font color=#990000>(</font>conn<font color=#990000>);</font><font color=#ff0000>}</font></span></span><span class=style3><strong><font color=#0000ff>return</font></strong> list<font color=#990000>;</font><br><font color=#ff0000>}</font></span><font color=#ff0000>}</font></tt></pre>
                        </td>
                    </tr>
                </tbody>
            </table>
            <p>&nbsp;</p>
            <table border=1>
                <tbody>
                    <tr>
                        <td width=697>
                        <pre><tt><em><font color=#9a1900>// 1.对于insert, update, delete语句<br></font></em><font color=#009900>int</font> count <font color=#990000>=</font> DbWrapper<font color=#990000>.</font><strong><font color=#000000>executeUpdate</font></strong><font color=#990000>(</font>sql<font color=#990000>)</font><font color=#990000>;<br></font><em><font color=#9a1900>// 2.对于selete语句</font></em>
                        java<font color=#990000>.</font>util<font color=#990000>.</font>List list <font color=#990000>=</font> DbWrapper<font color=#990000>.</font><strong><font color=#000000>executeQuery</font></strong><font color=#990000>(</font>sql<font color=#990000>)</font><font color=#990000>;<br></font><em><font color=#9a1900>// 方法一:按名字取值，注意大小写是严格区分的</font></em><strong><font color=#0000ff>for</font></strong><font color=#990000>(</font><font color=#009900>int</font> i <font color=#990000>=</font><font color=#993399>0</font><font color=#990000>;</font> i <font color=#990000>&lt;</font> list<font color=#990000>.</font><strong><font color=#000000>size</font></strong><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font> i<font color=#990000>+</font><font color=#990000>+</font><font color=#990000>)</font><font color=#ff0000>{</font>
                        java<font color=#990000>.</font>util<font color=#990000>.</font>Map map <font color=#990000>=</font><font color=#990000>(</font>java<font color=#990000>.</font>util<font color=#990000>.</font>Map<font color=#990000>)</font>list<font color=#990000>.</font><strong><font color=#000000>get</font></strong><font color=#990000>(</font>i<font color=#990000>)</font><font color=#990000>;</font>
                        out<font color=#990000>.</font><strong><font color=#000000>println</font></strong><font color=#990000>(</font>mag<font color=#990000>.</font><strong><font color=#000000>get</font></strong><font color=#990000>(</font><font color=#ff0000>"column_name"</font><font color=#990000>).</font><strong><font color=#000000>toString</font></strong><font color=#990000>());</font><font color=#ff0000>}<br></font><em><font color=#9a1900>// 方法二：遍历取值</font></em><strong><font color=#0000ff>for</font></strong><font color=#990000>(</font><font color=#009900>int</font> i <font color=#990000>=</font><font color=#993399>0</font><font color=#990000>;</font> i <font color=#990000>&lt;</font> list<font color=#990000>.</font><strong><font color=#000000>size</font></strong><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font> i<font color=#990000>+</font><font color=#990000>+</font><font color=#990000>)</font><font color=#ff0000>{</font>
                        java<font color=#990000>.</font>util<font color=#990000>.</font>Map map <font color=#990000>=</font><font color=#990000>(</font>java<font color=#990000>.</font>util<font color=#990000>.</font>Map<font color=#990000>)</font>list<font color=#990000>.</font><strong><font color=#000000>get</font></strong><font color=#990000>(</font>i<font color=#990000>)</font><font color=#990000>;<br></font><strong><font color=#0000ff>for</font></strong><font color=#990000>(</font>java<font color=#990000>.</font>util<font color=#990000>.</font>Iterator it <font color=#990000>=</font> map<font color=#990000>.</font><strong><font color=#000000>keySet</font></strong><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>.</font><strong><font color=#000000>iterator</font></strong><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font> it<font color=#990000>.</font><strong><font color=#000000>hasNext</font></strong><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font><font color=#990000>)</font><font color=#ff0000>{</font>
                        String column_name <font color=#990000>=</font> it<font color=#990000>.</font><strong><font color=#000000>next</font></strong><font color=#990000>(</font><font color=#990000>)</font><font color=#990000></font><font color=#990000>.</font><strong><font color=#000000>toString</font></strong><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font><br><br><em><font color=#9a1900>// 取值</font></em><font color=#9a1900>时注意null判断</font>
                        out<font color=#990000>.</font><strong><font color=#000000>println</font></strong><font color=#990000>(</font>column_name <font color=#990000>+</font><font color=#ff0000>" = "</font><font color=#990000>+</font> map<font color=#990000>.</font><strong><font color=#000000>get</font></strong><font color=#990000>(</font>column_name<font color=#990000>) </font><font color=#990000>=</font><font color=#990000>=</font><strong><font color=#0000ff>null</font></strong><font color=#990000>?</font><font color=#ff0000>""</font><font color=#990000>:</font> map<font color=#990000>.</font><strong><font color=#000000>get</font></strong><font color=#990000>(</font>column_name<font color=#990000>)</font>.<strong><font color=#000000>toString</font></strong><font color=#990000></font><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>);</font><font color=#ff0000>}</font><font color=#ff0000>}</font></tt></pre>
                        </td>
                    </tr>
                </tbody>
            </table>
            </td>
        </tr>
    </tbody>
</table>
</div>
<img src ="http://www.cppblog.com/aslucky/aggbug/63957.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/aslucky/" target="_blank">aslucky</a> 2008-10-14 14:40 <a href="http://www.cppblog.com/aslucky/archive/2008/10/14/63957.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javascript 有时很好用</title><link>http://www.cppblog.com/aslucky/archive/2008/08/25/59914.html</link><dc:creator>aslucky</dc:creator><author>aslucky</author><pubDate>Mon, 25 Aug 2008 07:42:00 GMT</pubDate><guid>http://www.cppblog.com/aslucky/archive/2008/08/25/59914.html</guid><wfw:comment>http://www.cppblog.com/aslucky/comments/59914.html</wfw:comment><comments>http://www.cppblog.com/aslucky/archive/2008/08/25/59914.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/aslucky/comments/commentRss/59914.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/aslucky/services/trackbacks/59914.html</trackback:ping><description><![CDATA[<h1 class=postTitle><a class=postTitle2 id=AjaxHolder_ctl01_TitleUrl href="http://www.cnblogs.com/wengjinbao/articles/600073.html"><u><font color=#810081>javascript 有时很好用(转)</font></u></a> </h1>
<div class=clear></div>
<div class=postBody>
<div class=postbody>注:页面上元素name属性和JavaScript引用的名称必须一致包括大小写<br>&nbsp;&nbsp;&nbsp;否则会提示你一个错误信息&nbsp;"引用的元素为空或者不是对象"<br>---------------------------------------------------------------------<br><br>对象属性<br>document.title&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//设置文档标题等价于HTML的&lt;title&gt;标签<br>document.bgColor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//设置页面背景色<br>document.fgColor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//设置前景色(文本颜色)<br>document.linkColor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//未点击过的链接颜色<br>document.alinkColor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//激活链接(焦点在此链接上)的颜色<br>document.vlinkColor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//已点击过的链接颜色<br>document.URL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//设置URL属性从而在同一窗口打开另一网页<br>document.fileCreatedDate&nbsp;&nbsp;&nbsp;//文件建立日期，只读属性<br>document.fileModifiedDate&nbsp;&nbsp;//文件修改日期，只读属性<br>document.fileSize&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//文件大小，只读属性<br>document.cookie&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//设置和读出cookie<br>document.charset&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//设置字符集&nbsp;简体中文:gb2312<br>---------------------------------------------------------------------<br>对象方法<br>document.write()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//动态向页面写入内容<br>document.createElement(Tag)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//创建一个html标签对象<br>document.getElementById(ID)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//获得指定ID值的对象<br>document.getElementsByName(Name)&nbsp;&nbsp;//获得指定Name值的对象<br>---------------------------------------------------------------------<br><br>images集合(页面中的图象)<br><br>a)通过集合引用<br>document.images&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//对应页面上的&lt;img&gt;标签<br>document.images.length&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//对应页面上&lt;img&gt;标签的个数<br>document.images[0]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//第1个&lt;img&gt;标签&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>document.images[i]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//第i-1个&lt;img&gt;标签<br><br>b)通过nane属性直接引用<br>&lt;img&nbsp;name="oImage"&gt;<br>document.images.oImage&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//document.images.name属性<br><br>c)引用图片的src属性<br>document.images.oImage.src&nbsp;&nbsp;//document.images.name属性.src<br><br>d)创建一个图象<br>var&nbsp;oImage<br>oImage&nbsp;=&nbsp;new&nbsp;Image()<br>document.images.oImage.src="<a href="http://www.webjx.com/1.jpg%22" target=_blank><font color=#1d58d1><u>http://www.webjx.com/1.jpg"</u></font></a><br>同时在页面上建立一个&lt;img&gt;标签与之对应就可以显示<br><br>&lt;html&gt;<br>&lt;img&nbsp;name=oImage&gt;<br>&lt;script&nbsp;language="javascript"&gt;<br>&nbsp;&nbsp;&nbsp;var&nbsp;oImage<br>&nbsp;&nbsp;&nbsp;oImage&nbsp;=&nbsp;new&nbsp;Image()<br>&nbsp;&nbsp;&nbsp;document.images.oImage.src="<a href="http://www.webjx.com/1.jpg%22" target=_blank><font color=#1d58d1><u>http://www.webjx.com/1.jpg"</u></font></a><br>&lt;/script&gt;<br>&lt;/html&gt;<br><br>----------------------------------------------------------------------<br><br>forms集合(页面中的表单)<br><br>a)通过集合引用<br>document.forms&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//对应页面上的&lt;form&gt;标签<br>document.forms.length&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//对应页面上&lt;form&gt;标签的个数<br>document.forms[0]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//第1个&lt;form&gt;标签<br>document.forms[i]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//第i-1个&lt;form&gt;标签<br>document.forms[i].length&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//第i-1个&lt;form&gt;中的控件数<br>document.forms[i].elements[j]&nbsp;&nbsp;//第i-1个&lt;form&gt;中第j-1个控件<br><br>b)通过标签name属性直接引用<br>&lt;form&nbsp;name="Myform"&gt;&lt;input&nbsp;name="myctrl"&gt;&lt;/form&gt;<br>document.Myform.myctrl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//document.表单名.控件名<br><br>-----------------------------------------------------------------------<br>&lt;html&gt;<br>&lt;!--Text控件相关Script--&gt;<br>&lt;form&nbsp;name="Myform"&gt;<br>&lt;input&nbsp;type="text"&nbsp;name="oText"&gt;<br>&lt;input&nbsp;type="password"&nbsp;name="oPswd"&gt;<br>&lt;form&gt;<br>&lt;script&nbsp;language="javascript"&gt;<br>//获取文本密码框的值<br>document.write(document.Myform.oText.value)<br>document.write(document.Myform.oPswd.value)<br>&lt;/script&gt;<br>&lt;/html&gt;<br>-----------------------------------------------------------------------<br>&lt;html&gt;<br>&lt;!--Select控件相关Script--&gt;<br>&lt;form&nbsp;name="Myform"&gt;<br>&lt;select&nbsp;name="oSelect"&gt;<br>&lt;option&nbsp;value="1"&gt;1&lt;/option&gt;<br>&lt;option&nbsp;value="2"&gt;2&lt;/option&gt;<br>&lt;option&nbsp;value="3"&gt;3&lt;/option&gt;<br>&lt;/select&gt;<br>&lt;/form&gt;<br><br>&lt;script&nbsp;language="javascript"&gt;<br>&nbsp;&nbsp;&nbsp;//遍历select控件的option项<br>&nbsp;&nbsp;&nbsp;var&nbsp;length<br>&nbsp;&nbsp;&nbsp;length=document.Myform.oSelect.length<br>&nbsp;&nbsp;&nbsp;for(i=0;i&lt;length;i++)<br>&nbsp;&nbsp;&nbsp;document.write(document.Myform.oSelect[i].value)<br>&lt;/script&gt;<br><br>&lt;script&nbsp;language="javascript"&gt;<br>&nbsp;&nbsp;&nbsp;//遍历option项并且判断某个option是否被选中<br>&nbsp;&nbsp;&nbsp;for(i=0;i&lt;document.Myform.oSelect.length;i++){<br>&nbsp;&nbsp;&nbsp;if(document.Myform.oSelect[i].selected!=true)<br>&nbsp;&nbsp;&nbsp;document.write(document.Myform.oSelect[i].value)<br>&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;document.write("&lt;font&nbsp;color=red&gt;"+document.Myform.oSelect[i].value+"&lt;/font&gt;")&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;}<br>&lt;/script&gt;<br><br>&lt;script&nbsp;language="javascript"&gt;<br>&nbsp;&nbsp;&nbsp;//根据SelectedIndex打印出选中的option<br>&nbsp;&nbsp;&nbsp;//(0到document.Myform.oSelect.length-1)<br>&nbsp;&nbsp;&nbsp;i=document.Myform.oSelect.selectedIndex<br>&nbsp;&nbsp;&nbsp;document.write(document.Myform.oSelect[i].value)<br>&lt;/script&gt;<br><br>&lt;script&nbsp;language="javascript"&gt;<br>&nbsp;&nbsp;&nbsp;//动态增加select控件的option项<br>&nbsp;&nbsp;&nbsp;var&nbsp;oOption&nbsp;=&nbsp;document.createElement("OPTION");<br>&nbsp;&nbsp;&nbsp;oOption.text="4";<br>&nbsp;&nbsp;&nbsp;oOption.value="4";<br>&nbsp;&nbsp;&nbsp;document.Myform.oSelect.add(oOption);<br>&lt;/script&gt;<br>&lt;html&gt;<br>-----------------------------------------------------------------------<br>&lt;Div&nbsp;id="oDiv"&gt;Text&lt;/Div&gt;<br>document.all.oDiv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//引用图层oDiv<br>document.all.oDiv.style&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>document.all.oDiv.style.display=""&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//图层设置为可视<br>document.all.oDiv.style.display="none"&nbsp;&nbsp;//图层设置为隐藏<br>/*document.all表示document中所有对象的集合<br>只有ie支持此属性，因此也用来判断浏览器的种类*/<br>click()&nbsp;对象.click()&nbsp;使对象被点击。<br>closed&nbsp;对象.closed&nbsp;对象窗口是否已关闭true/false<br>clearTimeout(对象)&nbsp;清除已设置的setTimeout对象<br>clearInterval(对象)&nbsp;清除已设置的setInterval对象<br>confirm("提示信息")&nbsp;弹出确认框，确定返回true取消返回false<br>cursor:样式&nbsp;更改鼠标样式&nbsp;hand&nbsp;crosshair&nbsp;text&nbsp;wait&nbsp;help&nbsp;default&nbsp;auto&nbsp;e/s/w/n-resize<br><br>event.clientX&nbsp;返回最后一次点击鼠标X坐标值；<br>event.clientY&nbsp;返回最后一次点击鼠标Y坐标值；<br>event.offsetX&nbsp;返回当前鼠标悬停X坐标值<br>event.offsetY&nbsp;返回当前鼠标悬停Y坐标值<br><br>document.write(document.lastModified)&nbsp;网页最后一次更新时间<br>document.ondblclick=x&nbsp;当双击鼠标产生事件<br>document.onmousedown=x&nbsp;单击鼠标键产生事件<br><br>document.body.scrollTop;&nbsp;返回和设置当前竖向滚动条的坐标值，须与函数配合,<br>document.body.scrollLeft;&nbsp;返回和设置当前横向滚动务的坐标值，须与函数配合，<br>document.title&nbsp;document.title="message";&nbsp;当前窗口的标题栏文字<br>document.bgcolor&nbsp;document.bgcolor="颜色值";&nbsp;改变窗口背景颜色<br>document.Fgcolor&nbsp;document.Fgcolor="颜色值";&nbsp;改变正文颜色<br>document.linkcolor&nbsp;document.linkcolor="颜色值";&nbsp;改变超联接颜色<br>document.alinkcolor&nbsp;document.alinkcolor="颜色值";&nbsp;改变正点击联接的颜色<br>document.VlinkColor&nbsp;document.VlinkColor="颜色值";&nbsp;改变已访问联接的颜色<br>document.forms.length&nbsp;返回当前页form表单数<br>document.anchors.length&nbsp;返回当前页锚的数量<br>document.links.length&nbsp;返回当前页联接的数量<br>document.onmousedown=x&nbsp;单击鼠标触发事件<br>document.ondblclick=x&nbsp;双击鼠标触发事件<br>defaultStatus&nbsp;window.status=defaultStatus;&nbsp;将状态栏设置默认显示<br><br>function&nbsp;function&nbsp;xx(){...}&nbsp;定义函数<br>isNumeric&nbsp;判断是否是数字<br>innerHTML&nbsp;xx=对象.innerHTML&nbsp;输入某对象标签中的html源代码<br>innerText&nbsp;divid.innerText=xx&nbsp;将以div定位以id命名的对象值设为XX<br><br>location.reload();&nbsp;使本页刷新，target可等于一个刷新的网页<br><br>Math.random()&nbsp;随机涵数,只能是0到1之间的数,如果要得到其它数,可以为*10,再取整<br>Math.floor(number)&nbsp;将对象number转为整数，舍取所有小数<br>Math.min(1,2)&nbsp;返回1,2哪个小<br>Math.max(1,2)&nbsp;返回1,2哪个大<br><br>navigator.appName&nbsp;返回当前浏览器名称<br>navigator.appVersion&nbsp;返回当前浏览器版本号<br>navigator.appCodeName&nbsp;返回当前浏览器代码名字<br>navigator.userAgent&nbsp;返回当前浏览器用户代标志<br><br>onsubmit&nbsp;onsubmit="return(xx())"&nbsp;使用函数返回值<br>opener&nbsp;opener.document.对象&nbsp;控制原打开窗体对象<br><br>prompt&nbsp;xx=window.prompt("提示信息","预定值");&nbsp;输入语句<br>parent&nbsp;parent.框架名.对象&nbsp;控制框架页面<br><br>return&nbsp;return&nbsp;false&nbsp;返回值<br>random&nbsp;随机参数（0至1之间）<br>reset()&nbsp;form.reset();&nbsp;使form表单内的数据重置<br><br>split("")&nbsp;string.split("")&nbsp;将string对象字符以逗号隔开<br>submit()&nbsp;form对象.submit()&nbsp;使form对象提交数据<br><br>String对象的&nbsp;charAt(x)对象&nbsp;反回指定对象的第多少位的字母<br>lastIndexOf("string")&nbsp;从右到左询找指定字符，没有返回-1<br>indexOf("string")&nbsp;从左到右询找指定字符，没有返回-1<br>LowerCase()&nbsp;将对象全部转为小写<br>UpperCase()&nbsp;将对象全部转为大写<br>substring(0,5)&nbsp;string.substring(x,x)&nbsp;返回对象中从0到5的字符<br>setTimeout("function",time)&nbsp;设置一个超时对象<br>setInterval("function",time)&nbsp;设置一个超时对象<br><br>toLocaleString()&nbsp;x.toLocaleString()&nbsp;从x时间对象中获取时间，以字符串型式存在<br>typeof(变量名)&nbsp;检查变量的类型，值有：String,Boolean,Object,Function,Underfined<br><br>window.event.button==1/2/3&nbsp;鼠标键左键等于1右键等于2两个键一起按为3<br>window.screen.availWidth&nbsp;返回当前屏幕宽度(空白空间)<br>window.screen.availHeight&nbsp;返回当前屏幕高度(空白空间)<br>window.screen.width&nbsp;返回当前屏幕宽度(分辨率值)<br>window.screen.height&nbsp;返回当前屏幕高度(分辨率值)<br>window.document.body.offsetHeight;&nbsp;返回当前网页高度<br>window.document.body.offsetWidth;&nbsp;返回当前网页宽度<br>window.resizeTo(0,0)&nbsp;将窗口设置宽高<br>window.moveTo(0,0)&nbsp;将窗口移到某位置<br>window.focus()&nbsp;使当前窗口获得焦点<br>window.scroll(x,y)&nbsp;窗口滚动条坐标，y控制上下移动，须与函数配合<br>window.open()&nbsp;window.open("地址","名称","属性")<br>属性:toolbar(工具栏),location(地址栏),directions,status(状态栏),<br>menubar(菜单栏),scrollbar(滚动条),resizable(改变大小),&nbsp;width(宽),height(高),fullscreen(全&nbsp;屏),scrollbars(全屏时无滚动条无参&nbsp;数,channelmode(宽屏),left(打开窗口x坐标),top(打开窗口y坐标)<br>window.location&nbsp;=&nbsp;'view-source:'&nbsp;+&nbsp;window.location.href&nbsp;应用事件查看网页源代码;<br><br>a=new&nbsp;Date();&nbsp;//创建a为一个新的时期对象<br>y=a.getYear();&nbsp;//y的值为从对象a中获取年份值&nbsp;两位数年份<br>y1=a.getFullYear();&nbsp;//获取全年份数&nbsp;四位数年份<br>m=a.getMonth();&nbsp;//获取月份值<br>d=a.getDate();&nbsp;//获取日期值<br>d1=a.getDay();&nbsp;//获取当前星期值<br>h=a.getHours();&nbsp;//获取当前小时数<br>m1=a.getMinutes();&nbsp;//获取当前分钟数<br>s=a.getSeconds();&nbsp;//获取当前秒钟数<br><br>对象.style.fontSize="文字大小";<br>单位：mm/cm/in英寸/pc帕/pt点/px象素/em文字高<br>1in=1.25cm<br>1pc=12pt<br>1pt=1.2px(800*600分辩率下)<br><br>文本字体属性：<br>fontSize大小<br>family字体<br>color颜色<br>fontStyle风格，取值为normal一般,italic斜体,oblique斜体且加粗<br>fontWeight加粗,取值为100到900不等,900最粗,light,normal,bold<br>letterSpacing间距,更改文字间距离,取值为,1pt,10px,1cm<br>textDecoration:文字修饰;取值,none不修饰,underline下划线,overline上划线<br>background:文字背景颜色,<br>backgroundImage:背景图片,取值为图片的插入路径<br><br>点击网页正文函数调用触发器：<br><br>1.onClick&nbsp;当对象被点击<br>2.onLoad&nbsp;当网页打开,只能书写在body中<br>3.onUnload&nbsp;当网页关闭或离开时,只能书写在body中<br>4.onmouseover&nbsp;当鼠标悬于其上时<br>5.onmouseout&nbsp;当鼠标离开对象时<br>6.onmouseup&nbsp;当鼠标松开<br>7.onmousedown&nbsp;当鼠标按下键<br>8.onFocus&nbsp;当对象获取焦点时<br>9.onSelect&nbsp;当对象的文本被选中时<br>10.onChange&nbsp;当对象的内容被改变<br>11.onBlur&nbsp;当对象失去焦点<br>onsubmit=return(ss())表单调用时返回的值<br><br>直线&nbsp;border-bottom:1x&nbsp;solid&nbsp;black<br>虚线&nbsp;border-bottom:1x&nbsp;dotted&nbsp;black<br>点划线&nbsp;border-bottom:2x&nbsp;dashed&nbsp;black<br>双线&nbsp;border-bottom:5x&nbsp;double&nbsp;black<br>槽状&nbsp;border-bottom:1x&nbsp;groove&nbsp;black<br>脊状&nbsp;border-bottom:1x&nbsp;ridge&nbsp;black<br><br>1.边缘高光glow(color=颜色,strength=亮光大小)<br></div>
</div>
<img src ="http://www.cppblog.com/aslucky/aggbug/59914.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/aslucky/" target="_blank">aslucky</a> 2008-08-25 15:42 <a href="http://www.cppblog.com/aslucky/archive/2008/08/25/59914.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jsp 中文传参乱码的解决</title><link>http://www.cppblog.com/aslucky/archive/2008/08/21/59544.html</link><dc:creator>aslucky</dc:creator><author>aslucky</author><pubDate>Thu, 21 Aug 2008 08:19:00 GMT</pubDate><guid>http://www.cppblog.com/aslucky/archive/2008/08/21/59544.html</guid><wfw:comment>http://www.cppblog.com/aslucky/comments/59544.html</wfw:comment><comments>http://www.cppblog.com/aslucky/archive/2008/08/21/59544.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/aslucky/comments/commentRss/59544.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/aslucky/services/trackbacks/59544.html</trackback:ping><description><![CDATA[<p>&nbsp;</p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">&lt;%</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;request.setCharacterEncoding(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">gbk</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">%&gt;</span></div>
<br>加上这句即可。
<img src ="http://www.cppblog.com/aslucky/aggbug/59544.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/aslucky/" target="_blank">aslucky</a> 2008-08-21 16:19 <a href="http://www.cppblog.com/aslucky/archive/2008/08/21/59544.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>程序员的10种级别 转帖</title><link>http://www.cppblog.com/aslucky/archive/2008/07/30/57507.html</link><dc:creator>aslucky</dc:creator><author>aslucky</author><pubDate>Wed, 30 Jul 2008 06:23:00 GMT</pubDate><guid>http://www.cppblog.com/aslucky/archive/2008/07/30/57507.html</guid><wfw:comment>http://www.cppblog.com/aslucky/comments/57507.html</wfw:comment><comments>http://www.cppblog.com/aslucky/archive/2008/07/30/57507.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/aslucky/comments/commentRss/57507.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/aslucky/services/trackbacks/57507.html</trackback:ping><description><![CDATA[<font face=Arial size=2>第一级：神人，天资过人而又是技术狂热者同时还拥有过人的商业头脑，高瞻远瞩，技术过人，大器也。如丁磊，求伯君。&nbsp;<br><br>第二级：高人，有天赋，技术过人但没有过人的商业头脑，通常此类人不是顶尖黑客就是技术总监之流。&nbsp;<br><br>第三级：牛人，技术精湛，熟悉行业知识，敢于创新，有自己的公司和软件产品。&nbsp;<br><br>第四级：工头，技术精湛，有领导团队的能力，此类人大公司项目经理居多。&nbsp;<br><br>第五级：技术工人，技术精湛，熟悉行业知识但领导能力欠加，此类人大多为系分人员或资深程序员，基本上桀骜不逊，自视清高，不愿于一般技术人员为伍，在论坛上基本以高手面目出现。&nbsp;<br><br>第六级：熟练工人，技术有广度无深度，喜欢钻研但浅尝辄止。此类人大多为老程序员，其中一部分喜欢利用工具去查找网上有漏洞的服务器，干点坏事以获取成绩感。如果心情好，在论坛上他们会回答菜鸟的大部分问题。此级别为软件业苦力的重要组成部分。&nbsp;<br><br>第七级：工人，某些技术较熟练但缺乏深度和广度，此类人大多为程序员级别，经常在论坛上提问偶尔也回答菜鸟的问题。为软件产业苦力的主要组成部分。&nbsp;<br><br>第八级：菜鸟，入门时间不长，在论坛上会反复提问很初级的问题，有一种唐僧的精神。虽然招人烦但基本很可爱。只要认真钻研，一两年后就能升级到上一层。&nbsp;<br><br>第九级：大忽悠，利用中国教育的弊病，顶着一顶高学历的帽子，在小公司里混个软件部经理，设计不行，代码不行，只会胡乱支配下属，拍领导马屁，在领导面前胡吹海侃，把自己打扮成技术高手的模样。把勾心斗角的办公室文化引入技术部门，实在龌龊！&nbsp;<br><br>第十级：驴或傻X，会写SELECT语句就说自己精通ORALCE，连寄存器有几种都不知道就说自己懂汇编，建议全部送到日本当IT产业工人，挣了日本人的钱还严重打击日本的软件业！&nbsp;<br><br>其中又以前两级和后两级最为难得，其余级别只要努力，皆有可能达到。 </font><br>
<img src ="http://www.cppblog.com/aslucky/aggbug/57507.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/aslucky/" target="_blank">aslucky</a> 2008-07-30 14:23 <a href="http://www.cppblog.com/aslucky/archive/2008/07/30/57507.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>eclipse 使用myeclipse配置jsp开发环境</title><link>http://www.cppblog.com/aslucky/archive/2008/07/22/56864.html</link><dc:creator>aslucky</dc:creator><author>aslucky</author><pubDate>Tue, 22 Jul 2008 07:35:00 GMT</pubDate><guid>http://www.cppblog.com/aslucky/archive/2008/07/22/56864.html</guid><wfw:comment>http://www.cppblog.com/aslucky/comments/56864.html</wfw:comment><comments>http://www.cppblog.com/aslucky/archive/2008/07/22/56864.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/aslucky/comments/commentRss/56864.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/aslucky/services/trackbacks/56864.html</trackback:ping><description><![CDATA[<p>工作需要，使用eclipse开发一个简单的server。<br>使用jsp,mysql.<br>我下载的是myeclipse的完整的版本带eclipse的。比较省事。<br><br>启动后，破解，然后设置jdk<br>&nbsp;进行MyEclipse的配置，<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 从菜单栏中进入&#8220;Windows --&gt; Preferences&#8221;<br>3) 先要进行JDK的配置，<br>&nbsp;&nbsp;&nbsp; 在左侧栏中选择&#8220;Java --&gt; Installed JREs&#8221;，<br>&nbsp;&nbsp;&nbsp; 按&#8220;Add&#8221;按钮进行添加</p>
<p>4） 在弹出的&#8220;Add JRE&#8221;画面中，选择JRE的目录，<br>&nbsp;&nbsp;&nbsp;&nbsp; 就是选择你所在的JDK的目录，<br>&nbsp;&nbsp;&nbsp; 在JRE名称一栏中，填下想取的名称，我这里叫&#8220;JDK&#8221;，<br>&nbsp;&nbsp;&nbsp; 然后&#8220;OK&#8221;确定<br>&nbsp;&nbsp;&nbsp; tomcat也要使用jdk而不是jre否则会无法编译文件</p>
<p>5） 返回到设置框中，将刚刚配置的JRE选中</p>
<p>6） 开始配置MyEclipse，<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 左侧MyEclipse节点下&#8220;Application Server&#8221;中有Tomcat，<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 选择自己安装的版本，<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 将Tomcat Server设为可用，并设置Tomcat的安装目录<br>7） 在Tomcat的JDK中选择刚刚配置的JDK</p>
<br>然后就可以建一个web project工程测试一下了。<br>需要deploy到tomcat上面。<br><br>只是记录一下过程，写的比较不详细。<br>
<img src ="http://www.cppblog.com/aslucky/aggbug/56864.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/aslucky/" target="_blank">aslucky</a> 2008-07-22 15:35 <a href="http://www.cppblog.com/aslucky/archive/2008/07/22/56864.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>安家落户啦，这里比较适合我。</title><link>http://www.cppblog.com/aslucky/archive/2008/07/16/56340.html</link><dc:creator>aslucky</dc:creator><author>aslucky</author><pubDate>Wed, 16 Jul 2008 13:16:00 GMT</pubDate><guid>http://www.cppblog.com/aslucky/archive/2008/07/16/56340.html</guid><wfw:comment>http://www.cppblog.com/aslucky/comments/56340.html</wfw:comment><comments>http://www.cppblog.com/aslucky/archive/2008/07/16/56340.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/aslucky/comments/commentRss/56340.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/aslucky/services/trackbacks/56340.html</trackback:ping><description><![CDATA[为什么插入代码里面没有C/C++呢？难道是编程上有困难吗？<img height=20 src="http://www.cppblog.com/Emoticons/QQ/12.gif" width=20 border=0>
<img src ="http://www.cppblog.com/aslucky/aggbug/56340.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/aslucky/" target="_blank">aslucky</a> 2008-07-16 21:16 <a href="http://www.cppblog.com/aslucky/archive/2008/07/16/56340.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>