1.è°è½ä»ç»ä¸äºåç¹ç»å½ç³»ç»
2.MaxKey单点登录认证系统-开源IAM产品
3.java小程序源代码,网上简单点的点单点单航海类网页游戏源码,100多行,系统系统足彩卖料源码谁有啊
è°è½ä»ç»ä¸äºåç¹ç»å½ç³»ç»
tomcatççä¸è½½å°å
è¯è ï¼éå
--
ç¼è æï¼ç°å¨å¼åJava Webåºç¨ï¼å»ºç«åé¨ç½²Webå 容æ¯ä¸ä»¶å¾ç®åçå·¥ä½ã使ç¨Jakarta Tomcatä½ä¸ºServletåJSP容å¨ç人已ç»éåå ¨ä¸çãTomcatå ·æå è´¹ã跨平å°ç诸å¤ç¹æ§ï¼å¹¶ä¸æ´æ°å¾å¾å¿«ï¼ç°å¨é常çæµè¡ã
ä½ æéè¦åçå°±æ¯ï¼æç §ä½ çéæ±é ç½®Tomcatï¼åªè¦ä½ æ£ç¡®é ç½®ï¼Tomcatä¸è¬é½è½éåä½ çè¦æ±ãä¸é¢æ¯ä¸ç³»åå ³äºTomcatçé ç½®æå·§ï¼è¿äºæå·§æºèªäºæç书ï¼ãTomcatæå¨æåãï¼å¸æå¯¹ä½ ææ帮å©ãââ Jason Brittain
1ï¼ é 置系ç»ç®¡çï¼Admin Web Applicationï¼
大å¤æ°åä¸åçJ2EEæå¡å¨é½æä¾ä¸ä¸ªåè½å¼ºå¤§ç管ççé¢ï¼ä¸å¤§é½éç¨æäºç解çWebåºç¨çé¢ãTomcatæç §èªå·±çæ¹å¼ï¼åæ ·æä¾ä¸ä¸ªæçç管çå·¥å ·ï¼å¹¶ä¸ä¸æ¯«ä¸éäºé£äºåä¸åçç«äºå¯¹æãTomcatçAdmin Web Applicationæåå¨4.1çæ¬æ¶åºç°ï¼å½æ¶çåè½å æ¬ç®¡çcontextãdata sourceãuserågroupçãå½ç¶ä¹å¯ä»¥ç®¡çååå§ååæ°ï¼userãgroupãroleçå¤ç§æ°æ®åºç®¡ççãå¨åç»ççæ¬ä¸ï¼è¿äºåè½å°å¾å°å¾å¤§çæ©å±ï¼ä½ç°æçåè½å·²ç»é常å®ç¨äºã
Admin Web Application被å®ä¹å¨èªå¨é¨ç½²æ件ï¼CATALINA_BASE/webapps/admin.xml ã
ï¼è¯è 注ï¼CATALINA_BASEå³tomcatå®è£ ç®å½ä¸çserverç®å½ï¼
ä½ å¿ é¡»ç¼è¾è¿ä¸ªæ件ï¼ä»¥ç¡®å®Contextä¸çdocBaseåæ°æ¯ç»å¯¹è·¯å¾ãä¹å°±æ¯è¯´ï¼CATALINA_BASE/webapps/admin.xml çè·¯å¾æ¯ç»å¯¹è·¯å¾ãä½ä¸ºå¦å¤ä¸ç§éæ©ï¼ä½ ä¹å¯ä»¥å é¤è¿ä¸ªèªå¨é¨ç½²æ件ï¼èå¨server.xmlæ件ä¸å»ºç«ä¸ä¸ªAdmin Web Applicationçcontextï¼æææ¯ä¸æ ·çãä½ ä¸è½ç®¡çAdmin Web Applicationè¿ä¸ªåºç¨ï¼æ¢èè¨ä¹ï¼é¤äºå é¤CATALINA_BASE/webapps/admin.xml ï¼ä½ å¯è½ä»ä¹é½åä¸äºã
å¦æä½ ä½¿ç¨UserDatabaseRealmï¼é»è®¤ï¼ï¼ä½ å°éè¦æ·»å ä¸ä¸ªuser以åä¸ä¸ªroleå°CATALINA_BASE/conf/tomcat-users.xml æ件ä¸ãä½ ç¼è¾è¿ä¸ªæ件ï¼æ·»å ä¸ä¸ªåå«âadminâçrole å°è¯¥æ件ä¸ï¼å¦ä¸ï¼
<role name="admin"/>
ä½ åæ ·éè¦æä¸ä¸ªç¨æ·ï¼å¹¶ä¸è¿ä¸ªç¨æ·çè§è²æ¯âadminâã象åå¨çç¨æ·é£æ ·ï¼æ·»å ä¸ä¸ªç¨æ·ï¼æ¹åå¯ç ä½¿å ¶æ´å å®å ¨ï¼ï¼
<user name="admin" password="deep_dark_secret" roles="admin"/>
å½ä½ å®æè¿äºæ¥éª¤åï¼è¯·éæ°å¯å¨Tomcatï¼è®¿é® -->
<Host name="www.example.com" appBase="/home/example/webapp">
<Context path="" docBase="."/>
</Host>
</Engine>
</Service>
</Server>
Tomcatçserver.xmlæ件ï¼å¨åå§ç¶æä¸ï¼åªå æ¬ä¸ä¸ªèæ主æºï¼ä½æ¯å®å®¹æ被æ©å å°æ¯æå¤ä¸ªèæ主æºãå¨åé¢çä¾åä¸å±ç¤ºçæ¯ä¸ä¸ªç®åçserver.xmlçæ¬ï¼å ¶ä¸ç²ä½é¨åå°±æ¯ç¨äºæ·»å ä¸ä¸ªèæ主æºãæ¯ä¸ä¸ªHostå ç´ å¿ é¡»å æ¬ä¸ä¸ªæå¤ä¸ªcontextå ç´ ï¼æå å«çcontextå ç´ ä¸å¿ é¡»æä¸ä¸ªæ¯é»è®¤çcontextï¼è¿ä¸ªé»è®¤çcontextçæ¾ç¤ºè·¯å¾åºè¯¥ä¸ºç©ºï¼ä¾å¦ï¼path=ââï¼ã
5ï¼é ç½®åºç¡éªè¯ï¼Basic Authenticationï¼
容å¨ç®¡çéªè¯æ¹æ³æ§å¶çå½ç¨æ·è®¿é®åä¿æ¤çwebåºç¨èµæºæ¶ï¼å¦ä½è¿è¡ç¨æ·ç身份é´å«ãå½ä¸ä¸ªwebåºç¨ä½¿ç¨äºBasic Authenticationï¼BASICåæ°å¨web.xmlæ件ä¸auto-methodå ç´ ä¸è®¾ç½®ï¼ï¼èæç¨æ·è®¿é®åä¿æ¤çwebåºç¨æ¶ï¼Tomcatå°éè¿HTTP Basic Authenticationæ¹å¼ï¼å¼¹åºä¸ä¸ªå¯¹è¯æ¡ï¼è¦æ±ç¨æ·è¾å ¥ç¨æ·ååå¯ç ãå¨è¿ç§éªè¯æ¹æ³ä¸ï¼ææå¯ç å°è¢«ä»¥ä½çç¼ç æ¹å¼å¨ç½ç»ä¸ä¼ è¾ã
注æï¼ä½¿ç¨Basic Authenticationéè¿è¢«è®¤ä¸ºæ¯ä¸å®å ¨çï¼å 为å®æ²¡æ强å¥çå å¯æ¹æ³ï¼é¤éå¨å®¢æ·ç«¯åæå¡å¨ç«¯é½ä½¿ç¨HTTPSæè å ¶ä»å¯ç å å¯ç æ¹å¼ï¼æ¯å¦ï¼å¨ä¸ä¸ªèæç§äººç½ç»ä¸ï¼ãè¥æ²¡æé¢å¤çå å¯æ¹æ³ï¼ç½ç»ç®¡çåå°è½å¤æªè·ï¼æ滥ç¨ï¼ç¨æ·çå¯ç ãä½æ¯ï¼å¦æä½ æ¯åå¼å§ä½¿ç¨Tomcatï¼æè ä½ æ³å¨ä½ çwebåºç¨ä¸æµè¯ä¸ä¸åºäºå®¹å¨çå®å ¨ç®¡çï¼Basic Authenticationè¿æ¯é常æäºè®¾ç½®å使ç¨çãåªéè¦æ·»å <security-constraint>å<login-config>两个å ç´ å°ä½ çwebåºç¨çweb.xmlæ件ä¸ï¼å¹¶ä¸å¨CATALINA_BASE/conf/tomcat-users.xml æ件ä¸æ·»å éå½ç<role>å<user>å³å¯ï¼ç¶åéæ°å¯å¨Tomcatã
ä¸é¢ä¾åä¸çweb.xmlæèªä¸ä¸ªä¿±ä¹é¨ä¼åç½ç«ç³»ç»ï¼è¯¥ç³»ç»ä¸åªæmemberç®å½è¢«ä¿æ¤èµ·æ¥ï¼å¹¶ä½¿ç¨Basic Authenticationè¿è¡èº«ä»½éªè¯ã请注æï¼è¿ç§æ¹å¼å°ææç代æ¿Apache webæå¡å¨ä¸ç.htaccessæ件ã
<!--
Define the Members-only area,源码大话1.6游戏源码 by defining
a "Security Constraint" on this Application, and
mapping it to the subdirectory (URL) that we want
to restrict.
-->
<security-constraint>
<web-resource-collection>
<web-resource-name>
Entire Application
</web-resource-name>
<url-pattern>/members/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>member</role-name>
</auth-constraint>
</security-constraint>
<!-- Define the Login Configuration for this Application -->
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>My Club Members-only Area</realm-name>
</login-config>
6ï¼é ç½®åç¹ç»å½ï¼Single Sign-Onï¼
ä¸æ¦ä½ 设置äºrealmåéªè¯çæ¹æ³ï¼ä½ å°±éè¦è¿è¡å®é çç¨æ·ç»å½å¤çãä¸è¬è¯´æ¥ï¼å¯¹ç¨æ·èè¨ç»å½ç³»ç»æ¯ä¸ä»¶å¾éº»ç¦çäºæ ï¼ä½ å¿ é¡»å°½éåå°ç¨æ·ç»å½éªè¯ç次æ°ãä½ä¸ºç¼ºççæ åµï¼å½ç¨æ·ç¬¬ä¸æ¬¡è¯·æ±åä¿æ¤çèµæºæ¶ï¼æ¯ä¸ä¸ªwebåºç¨é½ä¼è¦æ±ç¨æ·ç»å½ãå¦æä½ è¿è¡äºå¤ä¸ªwebåºç¨ï¼å¹¶ä¸æ¯ä¸ªåºç¨é½éè¦è¿è¡åç¬çç¨æ·éªè¯ï¼é£è¿çèµ·æ¥å°±æç¹åä½ å¨ä¸ä½ çç¨æ·ææãç¨æ·ä»¬ä¸ç¥éææ ·æè½æå¤ä¸ªå离çåºç¨æ´åæä¸ä¸ªåç¬çç³»ç»ï¼ææä»ä»¬ä¹å°±ä¸ç¥éä»ä»¬éè¦è®¿é®å¤å°ä¸ªä¸åçåºç¨ï¼åªæ¯å¾è¿·æï¼ä¸ºä»ä¹æ»è¦ä¸åçç»å½ã
Tomcat 4çâsingle sign-onâç¹æ§å 许ç¨æ·å¨è®¿é®åä¸èæ主æºä¸ææwebåºç¨æ¶ï¼åªéç»å½ä¸æ¬¡ã为äºä½¿ç¨è¿ä¸ªåè½ï¼ä½ åªéè¦å¨Hostä¸æ·»å ä¸ä¸ªSingleSignOn Valveå ç´ å³å¯ï¼å¦ä¸æ示ï¼
<Valve className="org.apache.catalina.authenticator.SingleSignOn"
debug="0"/>
å¨Tomcatåå§å®è£ åï¼server.xmlç注ééé¢å æ¬SingleSignOn Valveé ç½®çä¾åï¼ä½ åªéè¦å»æ注éï¼å³å¯ä½¿ç¨ãé£ä¹ï¼ä»»ä½ç¨æ·åªè¦ç»å½è¿ä¸ä¸ªåºç¨ï¼å对äºåä¸èæ主æºä¸çææåºç¨åæ ·ææã
使ç¨single sign-on valveæä¸äºéè¦çéå¶ï¼
1> valueå¿ é¡»è¢«é ç½®ååµå¥å¨ç¸åçHostå ç´ éï¼å¹¶ä¸ææéè¦è¿è¡åç¹éªè¯çwebåºç¨ï¼å¿ é¡»éè¿contextå ç´ å®ä¹ï¼é½ä½äºè¯¥Hostä¸ã
2> å æ¬å ±äº«ç¨æ·ä¿¡æ¯çrealmå¿ é¡»è¢«è®¾ç½®å¨åä¸çº§Hostä¸æè åµå¥ä¹å¤ã
3> ä¸è½è¢«contextä¸çrealmè¦çã
4> 使ç¨åç¹ç»å½çwebåºç¨æ好使ç¨ä¸ä¸ªTomcatçå ç½®çéªè¯æ¹å¼ï¼è¢«å®ä¹å¨web.xmlä¸ç<auth-method>ä¸ï¼ï¼è¿æ¯èªå®ä¹çéªè¯æ¹å¼å¼ºï¼Tomcatå ç½®ççéªè¯æ¹å¼å æ¬basicãdigestãformåclient-certã
5> å¦æä½ ä½¿ç¨åç¹ç»å½ï¼è¿å¸æéæä¸ä¸ªç¬¬ä¸æ¹çwebåºç¨å°ä½ çç½ç«ä¸æ¥ï¼å¹¶ä¸è¿ä¸ªæ°çwebåºç¨ä½¿ç¨å®èªå·±çéªè¯æ¹å¼ï¼èä¸ä½¿ç¨å®¹å¨ç®¡çå®å ¨ï¼é£ä½ åºæ¬ä¸å°±æ²¡æäºãä½ çç¨æ·æ¯æ¬¡ç»å½åæ¥ææåºç¨æ¶éè¦ç»å½ä¸æ¬¡ï¼å¹¶ä¸å¨è¯·æ±æ°ç第ä¸æ¹åºç¨æ¶è¿å¾åç»å½ä¸æ¬¡ãå½ç¶ï¼å¦æä½ æ¥æè¿ä¸ªç¬¬ä¸æ¹webåºç¨çæºç ï¼èä½ åæ¯ä¸ä¸ªç¨åºåï¼ä½ å¯ä»¥ä¿®æ¹å®ï¼ä½é£ææä¹ä¸å®¹æåã
6> åç¹ç»å½éè¦ä½¿ç¨cookiesã
7ï¼é ç½®ç¨æ·å®å¶ç®å½ï¼Customized User Directoresï¼
ä¸äºç«ç¹å 许个å«ç¨æ·å¨æå¡å¨ä¸åå¸ç½é¡µãä¾å¦ï¼ä¸æ大å¦çå¦é¢å¯è½æ³ç»æ¯ä¸ä½å¦çä¸ä¸ªå ¬å ±åºåï¼æè æ¯ä¸ä¸ªISPå¸æç»ä¸äºweb空é´ç»ä»ç客æ·ï¼ä½è¿åä¸æ¯èæ主æºãå¨è¿ç§æ åµä¸ï¼ä¸ä¸ªå ¸åçæ¹æ³å°±æ¯å¨ç¨æ·ååé¢å ä¸ä¸ªç¹æ®å符ï¼~ï¼ï¼ä½ä¸ºæ¯ä½ç¨æ·çç½ç«ï¼æ¯å¦ï¼
/~username
Tomcatæä¾ä¸¤ç§æ¹æ³å¨ä¸»æºä¸æ å°è¿äºä¸ªäººç½ç«ï¼ä¸»è¦ä½¿ç¨ä¸å¯¹ç¹æ®çListenerå ç´ ãListenerçclassNameå±æ§åºè¯¥æ¯org.apache.catalina.startup.UserConfigï¼userClasså±æ§åºè¯¥æ¯å 个æ å°ç±»ä¹ä¸ãå¦æä½ çç³»ç»æ¯Unixï¼å®å°æä¸ä¸ªæ åç/etc/passwdæ件ï¼è¯¥æ件ä¸çå¸å·è½å¤è¢«è¿è¡ä¸çTomcatå¾å®¹æç读åï¼è¯¥æ件æå®äºç¨æ·ç主ç®å½ï¼ä½¿ç¨PasswdUserDatabase æ å°ç±»ã
<Listener className="org.apache.catalina.startup.UserConfig"
directoryName="public_html"
userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
webæ件éè¦æ¾ç½®å¨å/home/users/ian/public_html æè /users/jbrittain/public_htmlä¸æ ·çç®å½ä¸é¢ãå½ç¶ä½ ä¹å¯ä»¥æ¹åpublic_html å°å ¶ä»ä»»ä½åç®å½ä¸ã
å®é ä¸ï¼è¿ä¸ªç¨æ·ç®å½æ ¹æ¬ä¸ä¸å®éè¦ä½äºç¨æ·ä¸»ç®å½ä¸éé¢ãå¦æä½ æ²¡æä¸ä¸ªå¯ç æ件ï¼ä½ä½ åæ³æä¸ä¸ªç¨æ·åæ å°å°å ¬å ±çå/homeä¸æ ·ç®å½çåç®å½éé¢ï¼åå¯ä»¥ä½¿ç¨HomesUserDatabaseç±»ã
<Listener className="org.apache.catalina.startup.UserConfig"
directoryName="public_html" homeBase="/home"
userClass="org.apache.catalina.startup.HomesUserDatabase"/>
è¿æ ·ä¸æ¥ï¼webæ件就å¯ä»¥ä½äºå/home/ian/public_html æè /home/jasonb/public_htmlä¸æ ·çç®å½ä¸ãè¿ç§å½¢å¼å¯¹Windowsèè¨æ´å æå©ï¼ä½ å¯ä»¥ä½¿ç¨ä¸ä¸ªåc:\homeè¿æ ·çç®å½ã
è¿äºListenerå ç´ ï¼å¦æåºç°ï¼åå¿ é¡»å¨Hostå ç´ éé¢ï¼èä¸è½å¨contextå ç´ éé¢ï¼å 为å®ä»¬é½ç¨åºç¨äºHostæ¬èº«ã
8ï¼å¨Tomcatä¸ä½¿ç¨CGIèæ¬
Tomcat主è¦æ¯ä½ä¸ºServlet/JSP容å¨ï¼ä½å®ä¹æ许å¤ä¼ ç»webæå¡å¨çæ§è½ãæ¯æéç¨ç½å ³æ¥å£ï¼Common Gateway Interfaceï¼å³CGIï¼å°±æ¯å ¶ä¸ä¹ä¸ï¼CGIæä¾ä¸ç»æ¹æ³å¨ååºæµè§å¨è¯·æ±æ¶è¿è¡ä¸äºæ©å±ç¨åºãCGIä¹æ以被称为éç¨ï¼æ¯å 为å®è½å¨å¤§å¤æ°ç¨åºæèæ¬ä¸è¢«è°ç¨ï¼å æ¬ï¼Perlï¼Pythonï¼awkï¼Unix shell scriptingçï¼çè³å æ¬Javaãå½ç¶ï¼ä½ 大æ¦ä¸ä¼æä¸ä¸ªJavaåºç¨ç¨åºå½ä½CGIæ¥è¿è¡ï¼æ¯ç«è¿æ ·å¤ªè¿åå§ãä¸è¬èè¨ï¼å¼åServletæ»è¦æ¯CGIå ·ææ´å¥½çæçï¼å 为å½ç¨æ·ç¹å»ä¸ä¸ªé¾æ¥æä¸ä¸ªæé®æ¶ï¼ä½ ä¸éè¦ä»æä½ç³»ç»å±å¼å§è¿è¡å¤çã
Tomcatå æ¬ä¸ä¸ªå¯éçCGI Servletï¼å è®¸ä½ è¿è¡éçä¸æ¥çCGIèæ¬ã
为äºä½¿Tomcatè½å¤è¿è¡CGIï¼ä½ å¿ é¡»åå¦ä¸å 件äºï¼
1. æservlets-cgi.renametojar ï¼å¨CATALINA_HOME/server/lib/ç®å½ä¸ï¼æ¹å为servlets-cgi.jarãå¤çCGIçservletåºè¯¥ä½äºTomcatçCLASSPATHä¸ã
2. å¨TomcatçCATALINA_BASE/conf/web.xml æ件ä¸ï¼æå ³äº<servlet-name> CGIçé£æ®µç注éå»æï¼é»è®¤æ åµä¸ï¼è¯¥æ®µä½äºç¬¬è¡ï¼ã
3. åæ ·ï¼å¨TomcatçCATALINA_BASE/conf/web.xmlæ件ä¸ï¼æå ³äºå¯¹CGIè¿è¡æ å°çé£æ®µç注éå»æï¼é»è®¤æ åµä¸ï¼è¯¥æ®µä½äºç¬¬è¡ï¼ã注æï¼è¿æ®µå 容æå®äºHTMLé¾æ¥å°CGIèæ¬ç访é®æ¹å¼ã
4. ä½ å¯ä»¥æCGIèæ¬æ¾ç½®å¨WEB-INF/cgi ç®å½ä¸ï¼æ³¨æï¼WEB-INFæ¯ä¸ä¸ªå®å ¨çå°æ¹ï¼ä½ å¯ä»¥æä¸äºä¸æ³è¢«ç¨æ·çè§æåºäºå®å ¨èèä¸æ³æ´é²çæ件æ¾å¨æ¤å¤ï¼ï¼æè ä½ ä¹å¯ä»¥æCGIèæ¬æ¾ç½®å¨contextä¸çå ¶ä»ç®å½ä¸ï¼å¹¶ä¸ºCGI Servletè°æ´cgiPathPrefixåå§ååæ°ãè¿å°±æå®çCGI Servletçå®é ä½ç½®ï¼ä¸ä¸è½ä¸ä¸ä¸æ¥æå®çURLéåã
5. éæ°å¯å¨Tomcatï¼ä½ çCGIå°±å¯ä»¥è¿è¡äºã
å¨Tomcatä¸ï¼CGIç¨åºç¼ºçæ¾ç½®å¨WEB-INF/cgiç®å½ä¸ï¼æ£å¦åé¢ææ示çé£æ ·ï¼WEB-INFç®å½åä¿æ¤çï¼éè¿å®¢æ·ç«¯çæµè§å¨æ æ³çª¥æ¢å°å ¶ä¸å 容ï¼æ以对äºæ¾ç½®å«æå¯ç æå ¶ä»ææä¿¡æ¯çCGIèæ¬èè¨ï¼è¿æ¯ä¸ä¸ªé常好çå°æ¹ã为äºå ¼å®¹å ¶ä»æå¡å¨ï¼å°½ç®¡ä½ ä¹å¯ä»¥æCGIèæ¬ä¿åå¨ä¼ ç»ç/cgi-binç®å½ï¼ä½è¦ç¥éï¼å¨è¿äºç®å½ä¸çæ件æå¯è½è¢«ç½ä¸å¥½å¥çå²æµªè çå°ãå¦å¤ï¼å¨Unixä¸ï¼è¯·ç¡®å®è¿è¡Tomcatçç¨æ·ææ§è¡CGIèæ¬çæéã
9ï¼æ¹åTomcatä¸çJSPç¼è¯å¨ï¼JSP Compilerï¼
å¨Tomcat 4.1ï¼ææ´é«çæ¬ï¼å¤§æ¦ï¼ï¼JSPçç¼è¯ç±å å«å¨Tomcatéé¢çAntç¨åºæ§å¶å¨ç´æ¥æ§è¡ãè¿å¬èµ·æ¥æä¸ç¹ç¹å¥æªï¼ä½è¿æ£æ¯Antææ为ä¹çä¸é¨åï¼æä¸ä¸ªAPIææ¡£æ导å¼åè å¨æ²¡æå¯å¨ä¸ä¸ªæ°çJVMçæ åµä¸ï¼ä½¿ç¨Antãè¿æ¯ä½¿ç¨Antè¿è¡Javaå¼åçä¸å¤§ä¼å¿ãå¦å¤ï¼è¿ä¹æå³çä½ ç°å¨è½å¤å¨Antä¸ä½¿ç¨ä»»ä½javacæ¯æçç¼è¯æ¹å¼ï¼è¿éæä¸ä¸ªå ³äºApache Ant使ç¨æåçjavac pageå表ã使ç¨èµ·æ¥æ¯å®¹æçï¼å ä¸ºä½ åªéè¦å¨<init-param> å ç´ ä¸å®ä¹ä¸ä¸ªååå«âcompilerâï¼å¹¶ä¸å¨valueä¸æä¸ä¸ªæ¯æç¼è¯çç¼è¯å¨ååï¼ç¤ºä¾å¦ä¸ï¼
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>
org.apache.jasper.servlet.JspServlet
</servlet-class>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>WARNING</param-value>
</init-param>
<init-param>
<param-name>compiler</param-name>
<param-value>jikes</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
å½ç¶ï¼ç»åºçç¼è¯å¨å¿ 须已ç»å®è£ å¨ä½ çç³»ç»ä¸ï¼å¹¶ä¸CLASSPATHå¯è½éè¦è®¾ç½®ï¼é£å¤å³äºä½ éæ©çæ¯ä½ç§ç¼è¯å¨ã
ï¼éå¶ç¹å®ä¸»æºè®¿é®ï¼Restricting Access to Specific Hostsï¼
ææ¶ï¼ä½ å¯è½æ³éå¶å¯¹Tomcat webåºç¨ç访é®ï¼æ¯å¦ï¼ä½ å¸æåªæä½ æå®ç主æºæIPå°åå¯ä»¥è®¿é®ä½ çåºç¨ãè¿æ ·ä¸æ¥ï¼å°±åªæé£äºæå®çç客æ·ç«¯å¯ä»¥è®¿é®æå¡çå 容äºã为äºå®ç°è¿ç§ææï¼Tomcatæä¾äºä¸¤ä¸ªåæ°ä¾ä½ é ç½®ï¼RemoteHostValve åRemoteAddrValveã
éè¿é ç½®è¿ä¸¤ä¸ªåæ°ï¼å¯ä»¥è®©ä½ è¿æ»¤æ¥èªè¯·æ±ç主æºæIPå°åï¼å¹¶å 许ææç»åªäºä¸»æº/IPãä¸ä¹ç±»ä¼¼çï¼å¨Apacheç/products/jsp/tomcat/)ï¼å æ¤å ¶è¶æ¥è¶å¤çåå°è½¯ä»¶å ¬å¸åå¼å人åçåç±ãservletåjspçææ°è§èé½å¯ä»¥å¨tomcatçæ°çæ¬ä¸å¾å°å®ç°ã
äºï¼å®è£ åé ç½®
tomcatææ°çæ¬ä¸º4.0.1ï¼è¿ä¸ªçæ¬ç¨äºä¸ä¸ªæ°çservlet容å¨Catalinaï¼å®æ´çå®ç°äºservlet2.3åjsp1.2è§èã注æå®è£ ä¹åä½ çç³»ç»å¿ é¡»å®è£ äºjdk1.2以ä¸çæ¬ã
(ä¸)ï¼å®è£
1ï¼windowså¹³å°
ä»tomcatç½ç«ä¸è½½jakarta-tomcat-4.0.1.exeï¼æç §ä¸è¬çwindowsç¨åºå®è£ æ¥éª¤å³å¯å®è£ 好tomcat,å®è£ æ¶å®ä¼èªå¨å¯»æ¾ä½ çjdkåjreçä½ç½®ã
2ï¼linuxå¹³å°
ä¸è½½jakarta-tomcat-4.0.1.tar.gzï¼å°å ¶è§£åå°ä¸ä¸ªç®å½ã
(äº)ï¼é ç½®
è¿è¡tomcatéè¦è®¾ç½®JAVA_HOMEåé
set JAVA_HOME=c:/jdk (winï¼å¨msdosæ¹å¼ä¸ä½¿ç¨ï¼æè æ¾å ¥autoexec.batä¸)
export JAVA_HOME=/usr/local/jdk (linuxä¸ä½¿ç¨ï¼æ¾å°/etc/bashrcæè /etc/profileä¸)
(ä¸)ï¼è¿è¡
设置å®æ¯åå°±å¯ä»¥è¿è¡tomcatæå¡å¨äºï¼è¿å ¥tomcatçbinç®å½ï¼winä¸ç¨startupå¯å¨tomcatï¼linuxä¸ç¨startup.shï¼ç¸åºçå ³étomcatçå½ä»¤ä¸ºshutdownåshutdown.shã
å¯å¨åå¯ä»¥å¨æµè§å¨ä¸è¾å ¥ponents
private JButton clearJButton;
// no-argument constructor
public carshop()
{
createUserInterface();
}
// create and position GUI components; register event handlers
private void createUserInterface()
{
// get content pane for attaching GUI components
Container contentPane = getContentPane();
// enable explicit positioning of GUI components
contentPane.setLayout( null );
// set up windowJPanel
windowJPanel = new JPanel();
windowJPanel.setBounds( , , , );
windowJPanel.setBorder( new LineBorder( Color.BLACK ) );
windowJPanel.setLayout( null );
contentPane.add( windowJPanel );
// set up oneIconJLabel
oneIconJLabel = new JLabel();
oneIconJLabel.setBounds( , , , );
oneIconJLabel.setIcon( new ImageIcon( "images/阿斯顿马丁.jpg" ) );
windowJPanel.add( oneIconJLabel );
// set up oneJLabel
oneJLabel = new JLabel();
oneJLabel.setBounds( , , , );
oneJLabel.setText( "阿斯顿马丁" );
oneJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( oneJLabel );
// set up twoIconJLabel
twoIconJLabel = new JLabel();
twoIconJLabel.setBounds( , , , );
twoIconJLabel.setIcon( new ImageIcon( "images/美洲虎.jpg" ) );
windowJPanel.add( twoIconJLabel );
// set up twoJLabel
twoJLabel = new JLabel();
twoJLabel.setBounds( , , , );
twoJLabel.setText( "美洲虎" );
twoJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( twoJLabel );
// set up threeIconJLabel
threeIconJLabel = new JLabel();
threeIconJLabel.setBounds( , , , );
threeIconJLabel.setIcon( new ImageIcon(
"images/凯迪拉克.jpg" ) );
windowJPanel.add( threeIconJLabel );
// set up threeJLabel
threeJLabel = new JLabel();
threeJLabel.setBounds( , , , );
threeJLabel.setText( "凯迪拉克" );
threeJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( threeJLabel );
// set up fourIconJLabel
fourIconJLabel = new JLabel();
fourIconJLabel.setBounds( , , , );
fourIconJLabel.setIcon( new ImageIcon( "images/罗孚.jpg" ) );
windowJPanel.add( fourIconJLabel );
// set up fourJLabel
fourJLabel = new JLabel();
fourJLabel.setBounds( , , , );
fourJLabel.setText( "罗孚" );
fourJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( fourJLabel );
// set up fiveIconJLabel
fiveIconJLabel = new JLabel();
fiveIconJLabel.setBounds( , , , );
fiveIconJLabel.setIcon( new ImageIcon(
"images/劳斯莱斯.jpg" ) );
windowJPanel.add( fiveIconJLabel );
// set up fiveJLabel
fiveJLabel = new JLabel();
fiveJLabel.setBounds( , , , );
fiveJLabel.setText( "劳斯莱斯" );
fiveJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( fiveJLabel );
// set up sixIconJLabel
sixIconJLabel = new JLabel();
sixIconJLabel.setBounds( , , , );
sixIconJLabel.setIcon( new ImageIcon( "images/别克.jpg" ) );
windowJPanel.add( sixIconJLabel );
// set up sixJLabel
sixJLabel = new JLabel();
sixJLabel.setBounds( , , , );
sixJLabel.setText( "别克" );
sixJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( sixJLabel );
// set up enterJButton
enterJButton = new JButton();
enterJButton.setBounds( , , , );
enterJButton.setText( "Enter" );
contentPane.add( enterJButton );
enterJButton.addActionListener(
new ActionListener() // anonymous inner class
{
// event handler called when enterJButton is clicked
public void actionPerformed( ActionEvent event )
{
enterJButtonActionPerformed( event );
}
} // end anonymous inner class
); // end call to addActionListener
// set up clearJButton
clearJButton = new JButton();
clearJButton.setBounds( , , , );
clearJButton.setText( "Clear" );
contentPane.add( clearJButton );
// set up inputJLabel
inputJLabel = new JLabel();
inputJLabel.setBounds( , , , );
inputJLabel.setText( "Please make selection:" );
contentPane.add( inputJLabel );
selectCountryJComboBox = new JComboBox( cars );
selectCountryJComboBox.setBounds( , , , );
selectCountryJComboBox.setMaximumRowCount( 3 );
contentPane.add( selectCountryJComboBox );
// set up inputJTextField
inputJLabel2 = new JLabel();
inputJLabel2.setBounds( , , , );
inputJLabel2.setText( "Input the Numble:" );
contentPane.add( inputJLabel2 );
// set up inputJTextField
inputJTextField2 = new JTextField();
inputJTextField2.setBounds( , , , );
inputJTextField2.setHorizontalAlignment( JTextField.RIGHT );
contentPane.add( inputJTextField2 );
clearJButton.addActionListener(
new ActionListener() // anonymous inner class
{
// event handler called when clearJButton is clicked
public void actionPerformed( ActionEvent event )
{
clearJButtonActionPerformed( event );
}
} // end anonymous inner class
);
// set up displayJTextField
displayJTextArea = new JTextArea();
displayJTextArea.setBounds( , ,, );
displayJTextArea.setEditable( false );
contentPane.add( displayJTextArea );
// set properties of application's window
setTitle( "My car Shop" ); // set title bar string
setSize( , ); // set window size
setVisible( true ); // display window
} // end method createUserInterface
private void clearJButtonActionPerformed( ActionEvent event )
{
// clear the JTextFields
inputJTextField2.setText( "" );
displayJTextArea.setText("");
} // end method clearJButtonActionPerformed
private void enterJButtonActionPerformed( ActionEvent event )
{
double z;
double c;
int x;
int y;
x=selectCountryJComboBox.getSelectedIndex();
y=Integer.parseInt(inputJTextField2.getText());
double discountRate;
int amount = Integer.parseInt( inputJTextField2.getText());
switch (amount/5)
{
case 0:
discountRate = 0;
break;
case 1:
discountRate = 1;
break;
case 2:
discountRate = 2;
break;
case 3:
discountRate = 3;
break;
default:
discountRate = 4;
} // end switch statement
c=1-discountRate/;
z=jiage[x]*y*c;
displayJTextArea.append("你选择的是:"+cars[x]+";"+
"它的单价是:"+jiage[x]+";" +"你购买该产品的数量是:"+y+"," +"\n"+"该数量的套多通用后台源码折扣是:"
+discountRate + " %"+";"+"本次消费的总价格是:"+z+"元"+"!"+"\n");
}
public static void main( String args[] )
{
carshop application = new carshop();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
} // end method main
} // end class carshop
高级发卡源码_高级发卡源码有什么用
化妆品必须要溯源码扫描吗_化妆品必须要溯源码扫描吗是真的吗
一元交友盲盒源码免费下载_1元交友盲盒源码
多城市分类信息小程序源码_分类信息 小程序
移动 erp 源码_移动erp管理系统
通达信上升三角指标源码_通达信上升通道指标