变相怪杰 发表于 2015-1-18 11:27:36

JAVA教程之JSP - FAQ (1)

关于第二点:俺问问你,如果是企业级项目的话,诸如RMI,EJB,等一些关键技术,这些难道都不需要学么?如果光是使用jsp,servlet,javabean的话。jsJavaServerPagesFrequentlyAskedQuestions


Maintainer:RichardVowles,rvowles@esperanto.org.nz(http://www.esperanto.org.nz)



Questions
WhatisJSP?
WhatversionisthecurrentversionofJSP?
WherecanIgetthespecificationforJSP?
WhosupportsJSP?
WhatbooksareavailableforJSP?
IsJSPbetterthanASP(MicrosoftsActiveServerPages)?
WhatHTMLeditorssupportJSP?
Yes,buthowdoesitperform?
HowtoinvokeaJSPpagedirectlyfrombybrowser?
HowdoyouinvokeaJSPpagefromaservlet?
Howdoyoupassdata(includingbeans)toaJSPfromaservlet?
HowcanIpoolconnectionstomydatabase?
HowdoIuseotherlanguagesinmyJSP?
HowcanIsetacookieinJSP?
CanJSPandServletsharesameSessionandBeans?
HowdoIplugJSPintoMicrosoftsIISWebServer?
ArethereanynewsgroupsthatdiscussJSP?
Whatdothedifferinglevelsofbeanstorage(page,session,app)mean?
WherecanIfindthemailinglistarchives?
WhataretheimportantstepsinusingJDBCinJSP?
HowdoesvariablescopeworkinJSP?
HowdoIforwardtoanHTMLpage?
ArethereanywhitepapersordocumentsexplaininghowJSPfits?
HowtoIcreatedynamicGIFsformyJSP?
DoyouknowwhereIcouldgetsomecodethatwouldencodesomethingtotheHTMLDTDstandard?
Whatispagecompilation?
HowareservletsandJSPpagesrelated?
AnygoodwebsitesforuptodateactivitiesintheJava/JSP/Servletworld?
HowdoIforceausertologin?
SohowcananewbiegetstartedwithJSP?
HowcanIensurethatsessionobjectsstayinexistencewhenthewebserverrestarts?
HowcanIincludeoneJSPinsideanotherJSP?
Istheresomesortofeventthathappenswhenasessionobjectgetsboundorunboundtothesession?
IsthereawaytoexecuteaJSPfromthecomandlineorfrommyownapplication?
WhatshouldIuse,Model1orModel2?
HowdoIdeleteacookiewithJSP?
AretheretipsonthingstowatchoutforinJSP?
HowdoyougetstartedwithJSPontheMacintosh?
WhatApplicationServerssupportJSP?
WhathappenedtotheLOOPandDISPLAYtagsfromJSP0.92?
DoesJSPhaveabeanprovidingFileUploadfeatureslikeActiveXuploadcontrol?
SohowdoIuseEJBfromJSP?
CanIjustabortprocessingaJSP?
"ImtryingtopassanobjectbetweenaservletandaJSPpage,butmyobjectisnullontheJSPpage.Whatcouldbewrong?"




1)WhatisJSP?TOC


JSPisadynamicscriptingcapabilityforwebpagesthatallowsJavaaswellasafewspecialtagstobeembeddedintoawebfile(HTML/XML,etc).Thesuffixtraditionallyendswith.jsptoindicatetothewebserverthatthefileisaJSPfile.JSPisaserversidetechnology-youcantdoanyclientsidevalidationwithit.

JSPfilesactuallygetcompiledintoServlets,sowhatisthepoint?WhynotjustwriteServlets?

Formostpeople,thebenefitistwofold:

ThefocusisonHTML.JavaandtheJSPextensionsassistinmakingtheHTMLmore
functional.ServletsontheotherhandallowoutputtingofHTMLbutitisatedious
process.
ItiseasytomakeachangeandthenlettheJSPcapabilityoftheWebServeryouare
usingdealwithcompilingitintoaServletandrunningit.
Inthepast,peoplehaveusedservletsbecauseoftheproblemofredirection-becausebythetimetheJSPenginegetsaroundtowritinginformationbackdowntheHTTPpipe,youcouldnotdoaredirecteffectivelyinJSP-leadingtotheconceptsofModel1vsModel2(seequestion38).ThishasbeenfixedinJSP1.0withtheadditionofbufferedoutputstreams.

JavaSoftalsohasaFAQ,coveringdifferentquestions,anditislocatedathttp://java.sun.com/products/jsp/faq.html.

2)WhatversionisthecurrentversionofJSP?TOC



ThecurrentversionofJSPis1.1.Itisavailablefromhttp://java.sun.com/products/jsp.

TheJSP1.1isavailablefromhttp://java.sun.com/products/jsp/techinfo.html.

The0.92specisavailablefromhttp://java.sun.com/products/jsp/jsp092.html

The0.91specisapopularversionthough,andmuchsoftwarethatsupportstheJSPpre-standardactuallysupports0.91ofJSP.

The0.91specisavailablefromhttp://www.burridge.net/jsp/Spec91/jsp_spec.html

3)WherecanIgetthespecificationforJSP?TOC



Youcangetthecurrentspecfromhttp://java.sun.com/products/jsp.Thisisalongwiththereferenceimplementationwhichworkswithitsownwebserver.

4)WhosupportsJSP?TOC



Therearethefollowingimplementationsavailable:

Name
VersionofJSPSupported
Cost
Comments
JSPReference1.1freeTOMCAT-NowincludedaspartoftheJ2EEReferenceImplementation,butalsomanagedbytheJakartaProjectaspartofApache.Thisimplementationhasawaytogobeforebeingreadyforproduction.
GNUJSP1.0free,opensource,locatedinCVSattheGiantJavaTree
SunsJavaWebServer2.01.0commercialSunsownJavaWebServer.BeingreplacedwithiPlanet(Alliance)
PolyJSP0.92free,opensourcePolyJspisbasedonXML/XSLandhasbeendesignedtobeextensible.NowsupportsWebLHasntbeenupdatedforawhile.
Resin1.0,1.1inbetaUnknownNowOpenSource.
SJSP1.1freeforpersonaluseUsescompiletimeintrospection,allowsyoutoreplaceyourexistingJSPengineinyourwebserver.
zJSP0.91Lastupdated,Sept3,1998
JRUN0.92,1.0commercialJSP1.1supportnowinbeta.
Orion1.1commercialOrionisawebapplicationserverthatimplementsJSPinternally.ItalsohasalotofJSPvsotherJSPandvsASPstatsonitspages.AlsosupportsServlet2.2
ServletExec1.1commercialSupportslargenumberofwebservers
RocketJSP1.0GPLLocatedintheGiantJavaTree




5)WhatbooksareavailableforJSP?TOC



TherearenowanumberofbooksavailableonJSPfromvariouspublishers.

AquicksearchofAmazoncomesupwith

ProfessionalJavaServerProgramming:withServlets,JavaServerPages(JSP),XML,EnterpriseJavaBeans(EJB),JNDI,CORBA,JiniandJavaspaces
ProfessionalJavaXMLProgrammingwithservletsandJSP
PureJSPJavaServerPages
WebDevelopmentwithJavaServerPages
ThereisagroupofpeopleworkingonaWebbookforJSP-informationislocatedathttp://www.esperanto.org.nz/jspbook.Thereisanotherathttp://www.aptura.com/technology/jspBook_Architectures.htmlandyetanotheratBrainopolis.

6)IsJSPbetterthanASP(MicrosoftsActiveServerPages)?TOC



Thisisamatterofgreatdebate.ManypuntersthinkthatJavaSofthasthebenefitofhindsight-whatworkswellandwhatdoest.ASPisverycomplexbutsupportsmultiplescriptinglanguagesandtheActiveXmodelofMicrosoft.AlthoughASP_is_availableonmanyplatforms,theActiveXlibrarysupportthatmakesitaspowerfulasitisismissingandthusmakesActiveXonlyfeasibleforanNTplatform.

Accordingtorecentstatistics(seetheRedHatsite),22%ofwebserversareNT,(21%areLinux),thatmeansthereis78%needingsomethingelse,andJSPadvocatesbelievethatJSPfitsthebillnicelythatyouverymuch.

7)WhatHTMLeditorssupportJSP?TOC



MostofthevisualdevelopersdonotsupportJSPinanyway,shapeorform,theymessupthetagstotally.

ThefollowingHTMLeditorshavebeenknowntoworkwithJSP:


Product
Location
Comments
HomeSitehttp://www.allaire.com/JSPcolourcodingwillbeinHS4.0.1,butyoucangetapluginnowfromhttp://www.burridge.net/jsp/homesite.html
NetObjectsScriptBuilder3.0http://www.netobjects.com/products/html/nsb3.htmlWin32productsupportsJSP
Anytexteditor
BorlandJBuilder3.5http://www.borland.com/jbuilderJavaDevelopmenttool,supportsJSPinternally,andallowsrunninganddebuggingofJSPs
DreamWeaver3http://www.dreamweaver.com/IgnoresJSPtags,andallowsyoutoeditJSPfilesasiftheyareHTMLfilesgivenyoucustomisetheproductslightly(youneedtoeditaspecialfile)
FrontPage2000http://www.microsoft.com/frontpageSomereportsthatFrontPagenowignoresJSPtags.



8)Yes,buthowdoesitperform?TOC



Ihavebeenpickingupsomecomments:

BrianBurridge,brian_burridge@VALPAK.COM
"Ourextranetsfor300franchises,500+users,ourIntranetforthousandsofemployees,
andeventuallyallofourotherwebsites.NewAtlantahasbeenrunningfor6weeks
nowwithoutevenoneproblem.ProgramminginJSPhasturnedouttobeaseasyasPerl,
yetallourtestsshowittobeupto10xfaster."
AlsoavailableareasetofbenchmarksfromthepeoplewhomaketheOrionserver,locatedathttp://orion.evermind.net/,andalsofromthepeoplewhodoResin(comparingtheirJSPimplementationwithOrion)

9)HowtoinvokeaJSPpagedirectlyfrombybrowser?TOC



JSPfilesarejustlikeHTMLfiles,soifyourindex.jspfileisinyourrootdirectoryofyourwebsite,usehttp://localhost/index.jsp


net程序员的大部门代码都靠控件拖拽完成的,虽然java也有,但是无论从美观和速度上都没发和.net比。java程序员都是代码完成的,所以java程序员常戏称.net程序员是操作员,呵呵。

飘灵儿 发表于 2015-1-21 07:07:33

另外编写和运行Java程序需要JDK(包括JRE),在sun的官方网站上有下载,thinking in java第三版用的JDK版本是1.4,现在流行的版本1.5(sun称作J2SE 5.0,汗),不过听说Bruce的TIJ第四版国外已经出来了,是专门为J2SE 5.0而写的。

分手快乐 发表于 2015-1-22 13:04:49

象、泛型编程的特性,广泛应用于企业级Web应用开发和移动应用开发。

深爱那片海 发表于 2015-1-25 10:51:44

是一种突破用户端机器环境和CPU

金色的骷髅 发表于 2015-2-2 21:45:47

不过,每次的执行编译后的字节码需要消耗一定的时间,这同时也在一定程度上降低了 Java 程序的运行效率。

简单生活 发表于 2015-2-6 09:06:13

象、泛型编程的特性,广泛应用于企业级Web应用开发和移动应用开发。

海妖 发表于 2015-2-15 20:51:19

设计模式是高级程序员真正掌握面向对象核心思想的必修课。设计模式并不是一种具体"技术",它讲述的是思想,它不仅仅展示了接口或抽象类在实际案例中的灵活应用和智慧

不帅 发表于 2015-3-4 13:33:20

是一种将安全性(Security)列为第一优先考虑的语言

小妖女 发表于 2015-3-11 19:42:48

你现在最缺的是实际的工作经验,而不是书本上那些凭空想出来的程序。

再见西城 发表于 2015-3-19 10:24:10

应用在电视机、电话、闹钟、烤面包机等家用电器的控制和通信。由于这些智能化家电的市场需求没有预期的高,Sun公司放弃了该项计划。随着1990年代互联网的发展

柔情似水 发表于 2015-3-27 17:12:19

如果你学过HTML,那么事情要好办的多,如果没有,那你快去补一补HTML基础吧。其实JSP中的Java语法也不多,它更象一个脚本语言,有点象ASP。
页: [1]
查看完整版本: JAVA教程之JSP - FAQ (1)