初學(xué)者問的諸如:怎樣配置環(huán)境變量?怎樣運(yùn)行servlet啊?這樣的問題太多了,現(xiàn)在我寫一個初學(xué)者入門必讀,希望能對初學(xué)者有指導(dǎo)作用!
首先是下載工具:
我建議初學(xué)者用editplus+jdk,我覺得如果用例如jb,eclipse,jcreator,雖然剛開始的時候比較方便,但是確使初學(xué)者門不知道怎樣配置環(huán)境變量,從而難以達(dá)到知其然,知其所以然的地步。
可以通過如下地址下載:
editplus(最新版本是v2.11):http://count.skycn.com/softdown.php?id=3641&url=http://sc-http.skycn.net/down/epp211a_cn.exe
jdk(最新版本是java2sdk1_4_2):http://count.skycn.com/softdown.php?id=3116&url=http://sc-http.skycn.net/down/j2sdk-1_4_2-windows-i586.exe(這是for windows)
然后就是安裝jdk,我是把它裝到從c:/jdk目錄下面。
然后設(shè)置classpath的問題了:
正如操作系統(tǒng)利用path來搜索可執(zhí)行程序一樣,java運(yùn)行環(huán)境也會遍歷classpath來查找類,即便是helloworld這樣簡單的程序,jvm也會遍歷classpath定義的每一個路徑,直到找到相應(yīng)的文件為止。
相信大家用的系統(tǒng)不是2k就是xp,然后就應(yīng)當(dāng)如下設(shè)置path:
我的電腦->屬性->高級->環(huán)境變量
然后在環(huán)境變量的path后面追加: c:/jdk/bin;.;c:/jdk/lib
也可以這樣配置:c:/jdk/bin;.;c:/jdk/lib/dt.jar;c:/jdk/lib/tools.jar
記住:環(huán)境變量中的 . 切記不能少,它表示當(dāng)前路徑,如果少掉出現(xiàn)的錯誤等會就說!
dt.jar是關(guān)于運(yùn)行環(huán)境的類庫,tools.jar是關(guān)于一些工具的類庫
如果沒有配置:c:/jdk/bin,則會出現(xiàn) “ javac' 不是內(nèi)部或外部命令,也不是可運(yùn)行的程序或批處理文件。”這樣的錯誤。
下面我們就寫一個示例程序:
打開editplus,新建一個java文件,請照著如下輸入,要一字不漏,并且分清大小寫:
public class helloworld{
public static void main(string[] args){
system.out.println("hello,world!");
}
}
然后把這個文件保存(ctrl + s)到helloworld.java,java是分大小寫的,所以大小寫一定要分清,是helloworld.java不是helloworld.java或者其他。
運(yùn)行:開始->運(yùn)行->cmd
在控制臺中把目錄切換到當(dāng)前目錄:
javac helloworld.java
java helloworld
你就會在控制臺上看見輸出的hello,world!
javac是編譯命令,它把helloworld.java編譯成helloworld.class
java就是解釋命令,jvm把helloworld.class解釋執(zhí)行.
在這個時候:
1、如果出現(xiàn)exception in thread "main" java.lang.noclassdeffounderror: helloworld
那就是你在環(huán)境變量中沒有加上那個.(dot)
2、如果出現(xiàn)exception in thread "main" java.lang.nosuchmethoderror: main
或者h(yuǎn)elloworld.java:1: public class helloworld must be defined in a file called
"helloworld.java".
那就是你沒有分清大小寫的寫入這個helloworld,或者保存得時候沒有保存為helloworld.java。這個名字一定要跟public class的名字一樣
對于環(huán)境變量的問題就說到這里,下面我先所說怎么在editplus里面編譯和運(yùn)行,在tools->參數(shù)設(shè)置->配置用戶工具
1.添加工具(添加應(yīng)用程序)
菜單文字:compile java program
程序:c:/jdk/bin/javac.exe
參數(shù):文件名稱
初始目錄:文件目錄
2.添加工具(添加應(yīng)用程序)
菜單文字:run java program
程序:c:/jdk/bin/java.exe
參數(shù):文件名稱(不含擴(kuò)展名)
初始目錄:文件目錄
工具組名稱可以隨便添,比如debug java program。
然后在tools的下拉菜單中,你就會看見compile java program以及run java program這兩個選項(xiàng),以后你就可以利用ctrl + 1編譯和ctrl +2運(yùn)行程序了
下面我們討論servlet的運(yùn)行環(huán)境:
要運(yùn)行servlet,則需要jsp/servlet container,我建議初學(xué)者用tomcat。
tomcat(最新版本5.0):http://cvs.apache.org/builds/jakarta-tomcat-5/nightly/jakarta-tomcat-5-bin-20030725.zip
然后把這個壓縮包解壓到:
c:/tomcat
然后再配置環(huán)境變量;添加三個系統(tǒng)變量:
java_home: c:/jdk
tomcat_home: c:/tomcat
classpath: %java_home%/lib;%tomcat_home%/lib
tomcat的環(huán)境變量就配置完畢了,下面檢驗(yàn)tomcat是否能夠運(yùn)行:
在控制臺中轉(zhuǎn)到c:/tomcat/bin這個目錄,運(yùn)行startup,然后回出現(xiàn)一個窗口,連跳一大串東西,最后表示server已經(jīng)運(yùn)行。
在瀏覽器中輸入http://localhost:8080,出現(xiàn)歡迎界面,則表示tomcat沒問題了。然后和上面一樣,寫入你的第一個servlet。
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class helloworld extends httpservlet
{
public void doget(httpservletrequest request,httpservletresponse response)
throws servletexception,ioexception
{
response.setcontenttype("text/html");
printwriter out = response.getwriter();
out.println("<html><head><title>");
out.println("this is my first servlet");
out.println("</title></head><body>");
out.println("<h1>hello,world!</h1>");
out.println("</body></html>");
}
}
然后照樣用javac helloworld.java來編譯這個文件,如果出現(xiàn)無法import javax.servlet.*
那么就是應(yīng)該把c:/tomcat/common/lib里面的servlet.jar文件拷貝到c:/jdk/jre/lib/ext中,再次編譯,就沒有問題了!
然后在tomcat目錄里面的c:/tomcat/webapps/root里面按如下的文件結(jié)構(gòu):
root/index.html
root/welcom.jsp
root/web-inf/lib/myservlet.jar(如果你的servlet的.class打成了.jar文件,則放在lib下面)
root/web-inf/classes/helloworld.class(把上面生成的helloworld.class文件放在這個里面)
然后在瀏覽器中輸入http://localhost:8080/servlet/helloworld,于是server眾望所歸的報錯了:error 404--not found
怎么回事呢?
servlet必須使用c:/tomcat/webapps/root/web-inf這個目錄下面的web.xml文件進(jìn)行注冊,用ep打開這個web.xml文件,在里面加入:
<servlet>
<servlet-name>helloworld</servlet-name>
<servlet-class>helloworld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloworld</servlet-name>
<url-pattern>/servlet/helloworld</url-pattern>
</servlet-mapping>
這樣的結(jié)構(gòu)
<servlet>
<servlet-name>helloworld</servlet-name>
<servlet-class>helloworld</servlet-class>
</servlet>
表示指定包含的servlet類。而以下的結(jié)構(gòu):
<servlet-mapping>
<servlet-name>helloworld</servlet-name>
<url-pattern>/servlet/helloworld</url-pattern>
</servlet-mapping>
表示指定helloservlet應(yīng)當(dāng)映射到哪一種url模式。
在修改web.xml完畢過后,重新啟動server,然后再輸入http://localhost:8080/servlet/helloworld,那么偌大一個hello,world!等著你呢。
附:jsp開發(fā)環(huán)境配置全過程
在配置jsp開發(fā)環(huán)境的過程中會碰到不少問題,感謝許多前輩經(jīng)驗(yàn)總結(jié)性的文章對我來說簡直是雪中送碳,為了幫助像我一樣的初學(xué)者,在此總結(jié)了不少作者的經(jīng)驗(yàn),非常感謝他們的無私奉獻(xiàn)精神,也希望更多的人把這種精神發(fā)揚(yáng)光大。
以下軟件下載連接地址無法顯示的話,請直接到官方網(wǎng)站下載即可!
軟件下載
mysql
下載版本:mysql-4.1.13-win32.zip(windows downloads)
http://dev.mysql.com/downloads/mysql/4.1.html
jdbc驅(qū)動
下載版本:mysql-connector-java-3.1.10.zip
http://dev.mysql.com/downloads/connector/j/3.1.html
下載j2sdk
下載版本:jdk-1_5_0_04-windows-i586-p.exe
http://java.sun.com/j2se/1.5.0/download.jsp
下載tomcat
下載版本: jakarta-tomcat-5.5.9.exe
http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
安裝,配置j2sdk:
執(zhí)行j2sdk安裝程序,按默認(rèn)設(shè)置進(jìn)行安裝,也可自定義路徑,但需修改下面的配置
配置j2sdk:
配置環(huán)境變量:
我的電腦->屬性->高級->環(huán)境變量->系統(tǒng)變量中添加以下環(huán)境變量:
java_home=c:/program files/java/jdk1.5.0_04
classpath=%java_home%/lib/dt.jar;
%java_home%/lib/tools.jar;
path=%java_home%/bin;
%systemroot%/system32;
%systemroot%;
%systemroot%/system32/wbem
寫一個簡單的java程序來測試j2sdk是否已安裝成功:
public class hello
{
public static void main(string args[])
{
system.out.println("hello");
}
}
將程序保存為文件名為hello.java的文件。
打開命令提示符窗口,進(jìn)入到hello.java所在目錄,鍵入下面的命令:
javac hello.java
java hello
此時若打印出來hello則安裝成功,若沒有打印出這句話,仔細(xì)檢查以上配置是否正確。
注意系統(tǒng)文件夾選項(xiàng)中應(yīng)確定“隱藏已知文件類型的擴(kuò)展名”不勾選。
安裝,配置tomcat
執(zhí)行tomcat安裝程序,按默認(rèn)設(shè)置進(jìn)行安裝,也可自定義路徑,但需修改下面的配置:
我的電腦->屬性->高級->環(huán)境變量->系統(tǒng)變量中添加以下環(huán)境變量
catalina_home=c:/program files/apache
software foundation/tomcat 5.5
catalina_base=c:/program files/apache
software foundation/tomcat 5.5
修改環(huán)境變量中的classpath,把tomat安裝目錄下的common/lib下的servlet-api.jar添加到classpath中去,修改后的classpath如下:
classpath=%java_home%/lib/dt.jar;
%java_home%/lib/tools.jar;
c:/program files/apache software foundation/tomcat 5.5/common/lib/servlet-api.jar;
啟動tomcat,在ie中訪問http://localhost:8080,若看到tomcat的歡迎頁面的話說明安裝成功。
安裝mysql
解壓縮mysql-4.1.13-win32.zip,運(yùn)行setup.exe
首先出現(xiàn)的是安裝向?qū)g迎界面,直接點(diǎn)擊“next”繼續(xù),選擇安裝類型,選擇“自定義”custom安裝,然后點(diǎn)“next”下一步,出現(xiàn)自定義安裝界面,選擇安裝路徑:c:/mysql server 4.1(可自定義)點(diǎn)“ok”返回到自定義安裝界面,路徑已改為設(shè)置的路徑,點(diǎn)“next”,準(zhǔn)備開始安裝,點(diǎn)“install”開始安裝,完成后出現(xiàn)創(chuàng)建mysql.com帳號的界面。
如果是首次使用mysql,選“create anew free mysql.com accout”,點(diǎn)“next”,輸入你的email地址和自己設(shè)定的用于登錄mysql.com的密碼,填完后點(diǎn)“next”進(jìn)入第二步,填寫姓名等相關(guān)信息,填完點(diǎn)“next”,進(jìn)入第三步,填完電話號碼、公司名稱等信息后,點(diǎn)“next”,然后出現(xiàn)預(yù)覽你剛才填的信息的界面,點(diǎn)“next”出現(xiàn)安裝完成界面。
注意,這里有個配置向?qū)У倪x項(xiàng)(configure the mysql server now),建議勾選立即配置你的mysql。許多說安裝完mysql后無法啟動,原因就在于沒有配置mysql。
點(diǎn)擊“finish”完成安裝,并開始配置mysql,點(diǎn)“next”,進(jìn)入配置類型選擇頁面。選“detailed configuration”(詳細(xì)配置),點(diǎn)“next”,進(jìn)入服務(wù)類型選擇頁面。選“developer machine”(開發(fā)者機(jī)器),這樣占用系統(tǒng)的資源不會很多,點(diǎn)“next”后,進(jìn)入數(shù)據(jù)庫用法選擇頁面。
選擇“multifunctional database”,點(diǎn)“next”,進(jìn)入選擇innodb數(shù)據(jù)存放位置頁面,不用更改設(shè)置,直接放在installation path安裝目錄里即可,然后點(diǎn)“next”,選擇mysql的同時聯(lián)接數(shù),選擇“manual setting”,設(shè)置為100(根據(jù)自己需要,酌情設(shè)置)
點(diǎn)“next”,配置mysql在tcp/ip通訊環(huán)境中的端口選擇默認(rèn)的3306端口即可。點(diǎn)“next”,選擇mysql中的字符設(shè)置,注意,這里的選擇將會影響你是否能在mysql中使用中文。選擇gb2312字符集以便支持簡體中文,點(diǎn)“next”,設(shè)置windows服務(wù)選項(xiàng),注意,這里的選擇很關(guān)鍵。
“install as windows service”一定要勾選,這是將mysql作為windows的服務(wù)運(yùn)行。“service name”就用默認(rèn)的“mysql”下面的“l(fā)aunch the mysql server automatically”一定要勾選,這樣windows啟動時,mysql就會自動啟動服務(wù),要不然就要手工啟動mysql。
許多人說安裝mysql后無法啟動、無法連接、出現(xiàn)10061錯誤,原因就在這里。點(diǎn)“next”,設(shè)置根帳號root的登錄密碼,“modify security settings”是設(shè)置根帳號的密碼,輸入你設(shè)定的密碼即可。
“create an anonymous account”是創(chuàng)建一個匿名帳號,這樣會導(dǎo)致未經(jīng)授權(quán)的用戶非法訪問你的數(shù)據(jù)庫,有安全隱患,建議不要勾選。
點(diǎn)“next”,mysql配置向?qū)⒁罁?jù)你上面的所有設(shè)定配置mysql,以便mysql的運(yùn)行符合你的需要,點(diǎn)“execute”開始配置,當(dāng)出現(xiàn)“service started successfully”時,說明你的配置完成,mysql服務(wù)啟動成功
點(diǎn)“finish”完成,整個mysql的配置完成,剩下的就是用mysql客戶端連接mysql服務(wù)器,然后使用了。
安裝jdbc驅(qū)動:
解壓縮mysql-connector-java-3.1.10.zip
將要使用的是mysql-connector-java-3.1.10-bin-g.jar
和mysql-connector-java-3.1.10-bin.jar
配置
在c:/program files/java目錄下建立mysqlforjdbc子目錄,進(jìn)入該目錄將mysql-connector-java-3.
1.10-bin.jar到該目錄下
進(jìn)入c:/program
files/java/jdk1.5.0_04/lib目錄將mysql-connector-java-3.1.10-bin-g.jar拷貝到該目錄下
然后配置classpath,追加%java_home%/lib/mysql-connector-java-3.1.10-bin-g.
jar;c:/program
files/java/mysqlforjdbc/mysql-connector-java-3.1.10-bin.jar;到該環(huán)境變量中去。
追加以后環(huán)境變量如下:
classpath=%java_home%/lib/dt.jar;
%java_home%/lib/tools.jar;
c:/program files/apache software
foundation/tomcat5.5/common/lib/servlet-api.jar;
%java_home%/lib/mysql-connector-java-3.1.10-bin-g.jar;
c:/program files/java/mysqlforjdbc
/mysql-connector-java-3.1.10-bin.jar;
配置這個的目的是讓java應(yīng)用程序找到連接mysql的驅(qū)動。
查看并啟動mysql服務(wù)
在windows xp下安裝完mysql后,它就已經(jīng)自動啟動服務(wù)了,并且在開始菜單中有其客戶端的快捷方式連接,可以通過windows的服務(wù)管理器查看。“開始”-“運(yùn)行”,輸入“services.msc”,回車。
彈出windows的服務(wù)管理器,然后就可以看見服務(wù)名為“mysql”的服務(wù)項(xiàng)了,其右邊標(biāo)明“已啟動”在開始菜單-所有程序-mysql-mysql server 4.1-mysql command line client用客戶端的快捷方式連接,輸入安裝時設(shè)置的密碼即可。
數(shù)據(jù)庫的使用
mysql安裝完畢以后,在開始菜單-所有程序-mysql-mysql server 4.1-mysql command line client用客戶端的快捷方式連接
輸入安裝時設(shè)置的密碼
使用mysql的基本命令(在mysql命令行編輯每輸入完命令后最后一定要有分號)
顯示數(shù)據(jù)庫:show databases;
使用數(shù)據(jù)庫:use 數(shù)據(jù)庫名;
建庫
在mysql里建一個數(shù)據(jù)庫first,以及在數(shù)據(jù)庫里建一個表about
命令:create database first;
為數(shù)據(jù)庫設(shè)置權(quán)限(用戶和密碼)
命令:
grant all privileges on first.* to [email protected] identified by “123456”;
當(dāng)你執(zhí)行完這個命令以后,只要你再以用戶名:test,密碼:123456登錄時你就只可以對first這個數(shù)據(jù)庫操作,這樣避開使用root
輸入命令:use first;
使用first數(shù)據(jù)庫;
在first庫中建表
命令:
create table about(id int(8)
primary key,name varchar(10));
在表中假如數(shù)據(jù):
命令:
insert into about values
('xyw1026','laojiang');
退出
命令:
exit
jsp連接mysql
在c:/program files/apache software foundation/tomcat5.5/webapps目錄下建立子目錄myapp
進(jìn)入c:/program files/apache software foundation/tomcat5.5/webapps/myapp目錄下
用記事本編寫一個文件保存為first.jsp
代碼如下:
<%@ page contenttype="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%class.forname
("org.gjt.mm.mysql.driver").newinstance();
string url ="jdbc:mysql:
//localhost/softforum?user=
soft&password=soft1234&useunicode=
true&characterencoding=8859_1"
//first為你的數(shù)據(jù)庫名
connection conn= drivermanager.getconnection(url);
statement stmt=conn.createstatement
(resultset.type_scroll_sensitive,
resultset.concur_updatable);
string sql="select * from first";
resultset rs=stmt.executequery(sql);
while(rs.next()) {%>
您的第一個字段內(nèi)容為:<%=rs.getstring(1)%>
您的第二個字段內(nèi)容為:<%=rs.getstring(2)%>
<%}%>
<%out.print("數(shù)據(jù)庫操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
在瀏覽器中輸入:
http://127.0.0.1:8080/myapp/first.jsp
若出現(xiàn):
id|num
0 |laojiang
數(shù)據(jù)庫操作成功,恭喜你,表示配置成功
進(jìn)入c:/program files/apache software foundation/tomcat5.5/webapps/myapp目錄
在myapp目錄下新建一個目錄web-inf,注意,目錄名稱是區(qū)分大小寫的;
在web-inf下用記事本新建一個文件,命名為web.xml,內(nèi)容如下:
<?xml version="1.0" encoding="iso-8859-1"?>
<!doctype web-app
public "-//sun microsystems,
inc.//dtd web application 2.3//en"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>my web application</display-name>
<description>
a application for test.
</description>
</web-app>
在myapp下用記事本新建一個測試的jsp頁面,文件名為index.jsp,文件內(nèi)容如下:
<html><body><center>
now time is: <%=new java.util.date()%>
</center></body></html>
重啟tomcat
打開瀏覽器,輸入http://localhost:8080/myapp/index.jsp
看到當(dāng)前時間的話說明成功安裝。
建立自己的servlet:
用記事本新建一個servlet程序,文件名為helloworld.java,文件內(nèi)容如下:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class helloworld extends httpservlet
{
public void doget
(httpservletrequest request
,httpservletresponse response)
throws servletexception,ioexception
{
response.setcontenttype("text/html");
printwriter out = response.getwriter();
out.println("<html><head><title>");
out.println("this is my first servlet");
out.println("</title></head><body>");
out.println("<h1>hello,world!</h1>");
out.println("</body></html>");
}
}
編譯
將helloworld.java剪切到c:/program files/apache software foundation/tomcat5.5/common/classes目錄下
命令行方式下輸入:
cd c:/program files/apache software foundation
/tomcat5.5/common/classes
javac helloworld.java
用javac helloworld.java來編譯這個文件,如果出現(xiàn)無法import javax.servlet.*
則將c:/program files/apache software
foundation/tomcat5.5/common/lib目錄下的servlet-api.jar文件拷貝并添加到
c:/program files/java/jre1.5.0_04/lib/ext目錄中去就可以了。
然后在c:/program files/apache software
foundation/tomcat5.5/common/classes下會產(chǎn)生一個編譯后的servlet文件:
helloworld.class
用記事本打開c:/program files/apache software
foundation/tomcat5.5/webapps/root/web-inf目錄下的web.xml如下所示,添加后的
內(nèi)容如下:
<!-- jspc servlet mappings start -->
<servlet>
<servlet-name>org.apache.
jsp.index_jsp</servlet-name>
<servlet-class>org.apache.
jsp.index_jsp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.
jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>helloworld</servlet-name>
<servlet-class>helloworld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloworld</servlet-name>
<url-pattern>/servlet/helloworld</url-pattern>
</servlet-mapping>
<!-- jspc servlet mappings end -->
</web-app>
這段話中的servlet這一段聲明了你要調(diào)用的servlet,而servlet-mapping則是將聲明的servlet“映射”到/servlet/helloworld地址上。
啟動tomcat,啟動瀏覽器,輸入http://localhost:8080//servlet/helloworld,如果看到輸出helloworld!就說明編寫的servlet成功了。注意:修改了web.xml以及新加了class,都要重啟tomcat也可以在自己創(chuàng)建的目錄下測試如:
將helloworld.class拷貝到c:/program files/apache software
foundation/tomcat5.5/webapps/myapp/web-inf/classes目錄下
其中classes目錄若沒有就創(chuàng)建一個
用記事本打開c:/program files/apache software foundation/tomcat5.5/webapps/myapp/web-inf目錄下的web.xml如下所示,修改后的內(nèi)容如下:
<!-- jspc servlet mappings start -->
<servlet>
<servlet-name>helloworld</servlet-name>
<servlet-class>helloworld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloworld</servlet-name>
<url-pattern>/servlet/helloworld
</url-pattern>
</servlet-mapping>
<!-- jspc servlet mappings end -->
</web-app>
啟動tomcat,啟動瀏覽器,輸入http://localhost:8080/myapp/servlet/helloworld 如果看到輸出helloworld!就說明編寫的servlet成功了。注意:修改了web.xml以及新加了class,都要重啟tomcat,建立自己的javabean:
用記事本新建一個java程序,文件名為testbean.java,文件內(nèi)容如下:
package test;
public class testbean
{
private string name = null;
public testbean(string strname_p)
{
this.name=strname_p;
}
public void setname(string strname_p)
{
this.name=strname_p;
}
public string getname()
{
return this.name;
}
}
編譯
將testbean.java放在c:/test下,使用如下命令編譯:
c:/test>javac testbean.java
然后在c:/test下會產(chǎn)生一個編譯后的bean文件:testbean.class
將testbean.class文件剪切到c:/program files/apache software
foundation/tomcat5.5/webapps/myapp/web-inf/classes/test目錄下,
若無某些子目錄則創(chuàng)建一個,新建一個testbean.jsp文件,文件內(nèi)容為:
<%@ page import="test.testbean" %>
<html><body><center>
<%
testbean testbean=new testbean
("this is a test java bean.");
%>
java bean name is:
<%=testbean.getname()%>
</center></body></html>
重啟tomcat,啟動瀏覽器,輸入http://localhost:8080/myapp/testbean.jsp 如果看到輸出java bean name is: this is a test java bean 就說明編寫的javabean成功了。
新聞熱點(diǎn)
疑難解答
圖片精選