java在Linux下的web应用(二)转

80酷酷网    80kuku.com

  webgnujsp1.0.0在RedHat下基于apache&nbsnbsp;jserv的安装&nbsnbsp;

首先确认你已经安装了apache&nbsnbsp;jserv,如果你还没有安装apache&nbsnbsp;jserv,请参考在《RedHat下&nbsnbsp;

安装apache&nbsnbsp;jserv&nbsnbsp;1.1.2》一文。&nbsnbsp;

默认jserv安装在/usr/local/jserv下,jserv.conf在/usr/local/jserv/conf下&nbsnbsp;

一、需要的软件&nbsnbsp;

从http://www.klomp.org/gnujsp/取得gnujsp-1.0.0.tar.gz&nbsnbsp;

二、&nbsnbsp;

#cp&nbsnbsp;gnujsp-1.0.0.tar.gz&nbsnbsp;/usr/local&nbsnbsp;

#tar&nbsnbsp;xvzf&nbsnbsp;gnujsp-1.0.0.tar.gz&nbsnbsp;

#ln&nbsnbsp;-s&nbsnbsp;gnujsp-1.0.0&nbsnbsp;gnujsp&nbsnbsp;

#cd&nbsnbsp;/usr/local/jserv/etc&nbsnbsp;

#cp&nbsnbsp;zone.properties&nbsnbsp;alph.properties&nbsnbsp;

#vi&nbsnbsp;alph.properties修改alph.properties加入:&nbsnbsp;

#&nbsnbsp;List&nbsnbsp;of&nbsnbsp;Repositories&nbsnbsp;

#######################&nbsnbsp;

repositories=/usr/local/gnujsp-1.0.0/lib/gnujsp10.jar&nbsnbsp;

repositories=/usr/local/gnujsp-1.0.0/lib/servlet-2.0-plus.jar&nbsnbsp;

repositories=/your/jdbcbeans/path#你的javabean的路径&nbsnbsp;

#repositories=/home/heyl/lib/java/Acme.jar&nbsnbsp;

#repositories=/usr/local/webl-3.0/lib/WebL.jar&nbsnbsp;

#&nbsnbsp;Classloader&nbsnbsp;parameters&nbsnbsp;

#########################&nbsnbsp;

autoreload.classes=true&nbsnbsp;

#&nbsnbsp;Enable&nbsnbsp;servlet&nbsnbsp;resourced&nbsnbsp;autoreloading&nbsnbsp;(properties&nbsnbsp;and&nbsnbsp;other&nbsnbsp;

#&nbsnbsp;loaded&nbsnbsp;resources)&nbsnbsp;

autoreload.file=true&nbsnbsp;

...&nbsnbsp;

#&nbsnbsp;Servlet&nbsnbsp;Aliases&nbsnbsp;

##################&nbsnbsp;

#&nbsnbsp;Note:&nbsnbsp;if&nbsnbsp;using&nbsnbsp;webl&nbsnbsp;or&nbsnbsp;Acme&nbsnbsp;stuff,&nbsnbsp;add&nbsnbsp;the&nbsnbsp;jars&nbsnbsp;here&nbsnbsp;too&nbsnbsp;

#&nbsnbsp;if&nbsnbsp;you&nbsnbsp;added&nbsnbsp;them&nbsnbsp;to&nbsnbsp;the&nbsnbsp;repositories&nbsnbsp;above&nbsnbsp;(alph)&nbsnbsp;

#&nbsnbsp;In&nbsnbsp;my&nbsnbsp;real&nbsnbsp;settings&nbsnbsp;I&nbsnbsp;added:&nbsnbsp;usepackages=true,language=de,country=de&nbsnbsp;

#&nbsnbsp;but&nbsnbsp;I&nbsnbsp;guess&nbsnbsp;you&nbsnbsp;may&nbsnbsp;prefer&nbsnbsp;the&nbsnbsp;default&nbsnbsp;locale&nbsnbsp;:-)&nbsnbsp;(alph)&nbsnbsp;

servlet.gnujsp.code=org.gjt.jsp.JspServlet&nbsnbsp;

servlet.gnujsp.initArgs=checkclass=true,pagebase=/usr/local/www/doc,&nbsnbsp;

scratchdir=/var/local/apache/jsp,debug=true,compiler=builtin-javac&nbsnbsp;

-classpath&nbsnbsp;%classpath%:%scratchdir%:/usr/local/gnujsp-1.0.0/lib/servlet-2.0-plus.jar:&nbsnbsp;

/usr/local/gnujsp-1.0.0/lib/gnujsp10.jar:/your/jdbcbeans/path&nbsnbsp;

-d&nbsnbsp;%scratchdir%&nbsnbsp;-deprecation&nbsnbsp;%source%&nbsnbsp;

#其中$scratchdir为jsp文件生成的java和class文件的目录&nbsnbsp;

存盘&nbsnbsp;

三、&nbsnbsp;

#vi&nbsnbsp;jserv.properties加入&nbsnbsp;

wrapper.classpath=/usr/lib/jdk/lib/tools.zip&nbsnbsp;

wrapper.classpath=/usr/local/jserv/lib/ApacheJServ.jar&nbsnbsp;

wrapper.classpath=/usr/local/JSDK/lib/jsdk.jar&nbsnbsp;

......&nbsnbsp;

zones=root,alph&nbsnbsp;

......&nbsnbsp;

alph.properties=/usr/local/apache-1.3.6/conf/alph.properties&nbsnbsp;

......&nbsnbsp;

log.file=/usr/local/apache/logs/jserv.log#日志文件&nbsnbsp;

四、在/usr/local/jserv/etc/jserv.conf中加进&nbsnbsp;

ApJServMount&nbsnbsp;/alph&nbsnbsp;/alph&nbsnbsp;

Action&nbsnbsp;jsp-handler&nbsnbsp;/servlet/gnujsp&nbsnbsp;

AddHandler&nbsnbsp;jsp-handler&nbsnbsp;jsp&nbsnbsp;

五、&nbsnbsp;

启动你的apache&nbsnbsp;

把/usr/local/gnujsp/examples下的文件拷贝到web发布目录下,用浏览器调用&nbsnbsp;

http://yourserver/dir/date.jsp&nbsnbsp;

http://yourserver/dir/hello.jap&nbsnbsp;

http://yourserver/dir/snoop.jsp&nbsnbsp;

怎么样,结果出来了没有呢?&nbsnbsp;

然后你自己改动这些文件,加入中文测试,和servlet在redhat下一样,测试表明gnujsp也&nbsnbsp;

没有中文显示的问题。&nbsnbsp;

相关servlet/jsp信息请到java.sun.com查阅相关信息&nbsnbsp;



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: