|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果你学习的是市场营销,是销售,也许参加大课堂的学习会更合适,因为你的工作能力中有个基础就是搭建自己的人脉,js|servlet|编译信任良多刚入手下手进修Servlet和JSP的伴侣都有一个困扰,就是怎样疾速便利的创建一个Servlet和JSP的运转、调试和编译情况。自己如今正在外洋攻读MIT(MasterofInformationTechnology),如今选修的这一科是WBIS(WebBasedInformationSystems),其包括了很多种手艺,如Java,Perl,CGI,Servlet,ASP,JavaScript,JSP,OO,UML等等。上面的这篇文章是黉舍所供应的相干软件的下载地点、安装办法和相干申明,个中的所需的软件(黉舍已给我们供应了CD)我已全体安装并测试过。这里,我尽力保举给人人,由于全部安装历程十分的复杂,只需依照上面文章中的办法一步一步做,100%能够乐成,信任会给你带来匡助。固然文章是全英文的,但很复杂,信任人人都能分明。假如有甚么成绩,但愿人人能提出来我们一同会商。
(注:文章中所提到的四个软件分离是JDK1.3.1,BlueJ1.2.0,ApacheTomcat4.0和bluej_tomcat_config.zip。个中BlueJ是用来创立、编译Servlet的,而最初谁人zip文件则是设置BlueJ和Tomcat的。)
BlueJ,JakartaTomcatandJava2SDKInstallation
1.InstalltheJava2SoftwareDevelopmentKit(JDK)
ItisrecommendedthatyouinstallJDK1.3.1,whichcanbedownloadedfromhere(http://www.csu.edu.au/faculty/sciagr/sis/subjects/itc357/j2sdk-1_3_1-win.exe),orfromhttp://java.sun.com(unfortunatelyitisa30MdownloadsoifyouhaveaslowmodemitmaybebettertoacquireitonCD.Forexample,thereisaCDcontainingJDKwithmanyJavatextbooks).
InstallJDKtothedefaultdirectory,whichisc:jdk1.3.1
YoumayuseadifferentversionofJDK(1.2orlater)butyouwillneedtochangetheTomcatconfigurationfilesstartup.batandshutdown.battopointtothedirectorylocation.
2.InstallBlueJ(BlueJisabasicJavaeditingandcompilationenvironmentthatsitsontopofJDK)
ItisrecommendedthatyouinstallBlueJ1.2.0,whichcanbedownloadedfromhere(http://www.csu.edu.au/faculty/sciagr/sis/subjects/itc357/bluejsetup-120.exe)orfromhttp://bluej.org
InstallBlueJtothedefaultdirectoryc:BlueJ
IfyouinstalladifferentversionofBlueJorplaceitinadifferentdirectorytheconfigurationfilesprovidedinbluej_tomcat_config.zipwillnotautomaticallygointothecorrectdirectoriesandyouwillhavetomanuallyextracteachone.
3.InstallApacheTomcat(TomcatisaJavawebapplicationserverandwillallowyoutotestyourServletsandJSPfileslocally)
ItisrecommendedthatyouinstallApacheTomcat4.0,whichcanbedownloadedfromhere(http://www.csu.edu.au/faculty/sciagr/sis/subjects/itc357/jakarta-tomcat-4.0.4.exe)orfromhttp://jakarta.apache.org/
InstallTomcattothedefaultdirectoryc:ProgramFilesApacheTomcat4.0
IfyouinstalladifferentversionofTomcatorplaceitinadifferentdirectory,youwillneedtoconfigureitmanuallyastheconfigurationfilesprovidedinbluej_tomcat_config.zipwillnotautomaticallygointothecorrectdirectoriesandvariouspathssettingscontainedinthemwillnotbecorrect.
4.ConfigureBlueJandTomcattoworktogether
Therecommendedwaytodothisistodownloadthefilebluej_tomcat_config.zip(http://www.csu.edu.au/faculty/sciagr/sis/subjects/itc357/bluej_tomcat_config.zip)andextractthefilestotherootdirectoryondrivec:,makingsurethatyouchoosetheoptiontousefoldernames.
IfyouneedtomanuallyconfigureBlueJorTomcat,youneedtotroubleshootproblemsoryouwanttoexaminetheconfigurationoptionschosen,theyareexplainedhere.
CompilingandRunningServletsonYourLocalMachine
1.RunBlueJandopentheexistingprojectinthec:ProgramFilesApacheTomcat4.0webappsestingWeb-infclassesdirectory
2.Createanewclassandenterthecodeforyourservlet,oruseEdit-Addclassfromfiletoimportanexistingservletsourcefile.
3.Compiletheservlet.
4.Starttomcatbydouble-clickingonstartup.batinthec:ProgramFilesApacheTomcat4.0indirectory.ThiswillstartTomcatlisteningonport8080onyourlocalmachine(youdontneedtobeonline).
5.StartupyourwebbrowserandopentheURLhttp://localhost:8080/testing/servlet/ServletnamewhereServletnameisthenameofyourservlet.
Filelocationsandrelativereferenceswithinlocalandremoteservlets
HTMLfileslocatedinadirectorylikec:ProgramFilesApacheTomcat4.0webappsestingwillbeaccessiblethroughaURLlikehttp://localhost:8080/testing/filename.html
SimilarlyifyouplaceanHTMLfileinyourhomedirectoryontheSWAPserveritwillbeassessiblethroughaURLlikehttp://swap.csu.edu.au:8080/username/filename.html
Ifyouneedtoplaceanimageinapagegeneratedbyaservlet,youcanplaceitinc:ProgramFilesApacheTomcat4.0webappsesting(orontheswapserverinyourhomedirectory)andrefertoitintheHTMLas../imagename.jpg(eg.<IMGSRC=http://www.163design.net/j/f/".imagename.jpg">)
IfyouneedtolinktoanotherservletorspecifyanotherservletwithintheACTIONattributeofaform,youcansimplyusetheservletsname.Forexampleyoucouldusethecode<AHREF="OtherServlet">tolinktoanotherservletassumingthatyouhaveafileinthetestingWeb-infclassesdirectorycalledOtherServlet.class(orinyourWeb-infclassesdirectoryontheSWAPserver)
IfyouhaveastaticHTMLpagethathasalinktoaservletoraformwithanACTIONattributethatreferstoaservlet,andtheHTMLpageislocatedinthec:ProgramFilesApacheTomcat4.0webappsestingdirectoryorinyourhomedirectoryontheSWAPserver,usetheURLservlet/ServletNametorefertotheservlet(eg.ACTION="servlet/ServletName").
ItisrecommendedthatyouuserelativereferencesliketheseinyourHREF,SRCandACTIONattributessothatyoucaneasilymoveyourpagesfromthelocalmachinetotheserver.
不得不提一下的是:.net是看到java红,而开发出来的工具。 |
|