jspµÄweb.xmlÅäÖÃ˵Ã÷
Web.xml³£ÓÃÔªËØ
<web-app>
<display-name></display-name>¶¨ÒåÁËWEBÓ¦ÓõÄÃû×Ö
<description></description> ÉùÃ÷WEBÓ¦ÓõÄÃèÊöÐÅÏ¢
<context-param></context-param> context-paramÔªËØÉùÃ÷Ó¦Ó÷¶Î§Äڵijõʼ»¯²ÎÊý¡£
<filter></filter> ¹ýÂËÆ÷ÔªËؽ«Ò»¸öÃû×ÖÓëÒ»¸öʵÏÖjavax.servlet.Filter½Ó¿ÚµÄÀàÏà¹ØÁª¡£
<filter-mapping></filter-mapping> Ò»µ©ÃüÃûÁËÒ»¸ö¹ýÂËÆ÷£¬¾ÍÒªÀûÓÃfilter-mappingÔªËØ°ÑËüÓëÒ»¸ö»ò¶à¸öservlet»òJSPÒ³ÃæÏà¹ØÁª¡£
<listener></listener>servlet APIµÄ°æ±¾2.3Ôö¼ÓÁ˶Ôʼþ¼àÌý³ÌÐòµÄÖ§³Ö£¬Ê¼þ¼àÌý³ÌÐòÔÚ½¨Á¢¡¢Ð޸ĺÍɾ³ý»á»°»òservlet»·¾³Ê±µÃµ½Í¨Öª¡£
ListenerÔªËØÖ¸³öʼþ¼àÌý³ÌÐòÀà¡£
<servlet></servlet> ÔÚÏòservlet»òJSPÒ³ÃæÖƶ¨³õʼ»¯²ÎÊý»ò¶¨ÖÆURLʱ£¬±ØÐëÊ×ÏÈÃüÃûservlet»òJSPÒ³Ãæ¡£ServletÔªËؾÍÊÇÓÃÀ´Íê³É´ËÏîÈÎÎñµÄ¡£
<servlet-mapping></servlet-mapping> ·þÎñÆ÷Ò»°ãΪservletÌṩһ¸öȱʡµÄURL£ºhttp://host/webAppPrefix/servlet/ServletName¡£
µ«ÊÇ£¬³£³£»á¸ü¸ÄÕâ¸öURL£¬ÒÔ±ãservlet¿ÉÒÔ·ÃÎʳõʼ»¯²ÎÊý»ò¸üÈÝÒ׵ش¦ÀíÏà¶ÔURL¡£ÔÚ¸ü¸ÄȱʡURLʱ£¬Ê¹ÓÃservlet-mappingÔªËØ¡£
<session-config></session-config> Èç¹ûij¸ö»á»°ÔÚÒ»¶¨Ê±¼äÄÚδ±»·ÃÎÊ£¬·þÎñÆ÷¿ÉÒÔÅ×ÆúËüÒÔ½ÚÊ¡ÄÚ´æ¡£
¿Éͨ¹ýʹÓÃHttpSessionµÄsetMaxInactiveInterval·½·¨Ã÷È·ÉèÖõ¥¸ö»á»°¶ÔÏóµÄ³¬Ê±Öµ£¬»òÕß¿ÉÀûÓÃsession-configÔªËØÖƶ¨È±Ê¡³¬Ê±Öµ¡£
<mime-mapping></mime-mapping>Èç¹ûWebÓ¦ÓþßÓÐÏëµ½ÌØÊâµÄÎļþ£¬Ï£ÍûÄܱ£Ö¤¸øËûÃÇ·ÖÅäÌض¨µÄMIMEÀàÐÍ£¬Ôòmime-mappingÔªËØÌṩÕâÖÖ±£Ö¤¡£
<welcome-file-list></welcome-file-list> ָʾ·þÎñÆ÷ÔÚÊÕµ½ÒýÓÃÒ»¸öĿ¼Ãû¶ø²»ÊÇÎļþÃûµÄURLʱ£¬Ê¹ÓÃÄĸöÎļþ¡£
<error-page></error-page> ÔÚ·µ»ØÌض¨HTTP״̬´úÂëʱ£¬»òÕßÌض¨ÀàÐ͵ÄÒì³£±»Å׳öʱ£¬Äܹ»Öƶ¨½«ÒªÏÔʾµÄÒ³Ãæ¡£
<taglib></taglib> ¶Ô±ê¼Ç¿âÃèÊö·ûÎļþ£¨Tag
Ïà¹ØÎĵµ£º
ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
<%@ include file=" "%>
<jsp:include page=" " flush="true"/>
Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ.
ͨ³£µ±Ó¦ÓóÌÐòÖÐËùÓеÄÒ³ÃæµÄijЩ²¿·Ö(ÀýÈç±êÌâ¡¢Ò³½ÅºÍµ¼º½À¸)¶¼ÏàͬµÄʱºò,Î ......
Ò»¡¢ÏÂÔØ
J2SDK£ºjdk-1_5_0_04-windows-i586-p.exe
ECLIPSE£ºeclipse-SDK-3.2-win32.zip
ECLIPSE ²å¼þ£º
(1)ÖÐÎÄ°ü NLpack1-eclipse-SDK-3.2-win32.zip
(2)Tomcat²å¼þ tomcatPluginV31.zip
(3)LOMBAT£ºlomboz-wtp-emf-gef-jem-3.1.2.zip
TOMCAT£ºapache-tomcat-5.5.17.exe
mysql£ºMysql-5.0.15.rar
¶þ¡¢°²×°
1.°² ......
ÏÂÃæµÄjspºÍÊý¾Ý¿âÁ¬½Ó´óÈ«£¬Çë²Î¿¼
Ò»¡¢jspÁ¬½ÓOracle8/8i/9iÊý¾Ý¿â£¨ÓÃthinģʽ£©
testoracle.jspÈçÏ£º
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Stri ......
index.jsp:
<html>
<head>
<title>The News</title>
</head>
<body>
<h1> Latest News</h1>
<table>
<tr>
<td><h3><%@include file="items/news1.jsp" %></h3></td>
</tr>
<tr>
<td> ......
½â¾öjsp»òserverlet ²»ÄܽâÎömultipart/form-data ÀàÐÍµÄ±íµ¥ÓòµÄÎÊÌâ
10 6ÔÂ 2008
Situation:
Javax.servlet.HttpServletRequest.getParameter(String) returns null when the ContentType is multipart/form-data
Solutions:
Solution A:
1. download http://www.servlets.com/cos/index.html
2. invoke getPara ......