Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÓÃjsp:include ¿ØÖƶ¯Ì¬ÄÚÈÝ

Çåµ¥ 1. JSP include αָÁî
<![CDATA[
<%@ page language="java" contentType="text/html" %>
<html>
<head>
<title>newInstance.com</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<link href="/styles/default.css"
rel="stylesheet" type="text/css" />
</head>
<body>
<%@ include file="header.jsp" %>
<%@ include file="navigation.jsp" %>
<%@ include file="bookshelf.jsp" %>
<%@ include file="/mt-blogs/index.jsp" %>
<%@ include file="footer.jsp" %>
</body>
</html>
]]>
ÄúÐèҪʲô
±¾ÏµÁÐÖеÄËùÓÐ×î¼Ñʵ¼ù¶¼»ùÓÚ JavaServer Pages ¼¼Êõ¡£ÒªÔËÐÐÆäÖеÄÈκÎ×î¼Ñʵ¼ù£¬¶¼ÐèÒªÔÚÄúµÄ±¾µØ»úÆ÷»ò²âÊÔ·þÎñÆ÷ÉÏ°²×°·ûºÏ JSP ¼¼ÊõµÄ Web ÈÝÆ÷¡£Äú»¹ÐèҪʹÓÃÎı¾±à¼­Æ÷»ò IDE À´¶Ô JSP Ò³Ãæ±àÂë¡£
ËäÈ» include ·Ç³£ÊÊÓÚ½«¾²Ì¬ÄÚÈݲ¢Èë Web Ò³Ã棬µ«¶ÔÓÚ¶¯Ì¬ÄÚÈÝÈ´²»¾¡ÈçÈËÒâ¡£ÎÒÃÇÔÚǰһƪÎÄÕÂÖÐÔÚÊÔͼÖØÐÂ×°Èë¸ßËÙ»º´æÎļþʱ·¢ÏÖÁËÕâÒ»ÎÊÌâ¡£Óë´ó¶àÊýҳüÎļþ¼°Ò³½ÅÎļþ²»Í¬£¬¶¯Ì¬ÄÚÈݱ仯Ƶ·±£¬±ØÐëʱ¿Ì¸üС£ÎÒÃǽ«Ê×ÏȶóÒªµØÖØÊöһϠinclude αָÁîµÄ¾ÖÏÞÐÔ£¬È»ºóÎÒ½«ÏòÄúÑÝʾÈçºÎÓà jsp:include ±ê¼ÇÀ´À©Õ¹ JSP µÄ°üº¬ÄÜÁ¦¡£
¸ßËÙ»º´æÎÊÌâ
JSP include αָÁîµÄ²»×ãÖ®´¦ÓÐÒ»¸öÊÇ£ºËü»áµ¼Ö Web ä¯ÀÀÆ÷¸ßËÙ»º´æËùÓÐÒ³Ãæ¡£ÔÚ´¦ÀíÖîÈçÒ³½Å¡¢°æȨÉùÃ÷»òÒ»×龲̬Á´½ÓÖ®ÀàµÄ¾²Ì¬×é¼þʱ£¬ÕâÊÇÓÐÒâÒåµÄ¡£ÕâЩÎļþ²»»á¸Ä±ä£¬Òò´ËûÓÐÀíÓÉÈà JSP ½âÊÍÆ÷²»¶ÏµØÖØÐÂÂÖѯÆäÖеÄÊý¾Ý¡£·²ÊÇ¿ÉÄܵĵط½£¬¶¼Ó¦¸ÃʵÏÖ¸ßËÙ»º´æ£¬ÒòΪËü¸ÄÉÆÁËÓ¦ÓóÌÐòµÄÐÔÄÜ¡£
JSP ²âÊԺͿª·¢
ÔÚ¹¹½¨ Web Ó¦ÓóÌÐò»òÍøվʱ£¬¿ÉÄÜÐèÒª´óÁ¿¸üÐÂҳü¡¢Ò³½ÅºÍµ¼º½Á´½Ó¡£½ö½öΪÁË¿´µ½¶ÔËù°üº¬ÎļþËù×öµÄ¸ü¸Ä£¬¶ø±»ÆȲ»¶ÏµØ¹Ø±Õä¯ÀÀÆ÷»òÇå³ýÆä¸ßËÙ»º´æ£¬Õâ¿ÉÄÜÊǼþÍ´¿àµÄÊÂÇé¡£ÁíÒ»·½Ã棬ΪÁ˽áÊø¿ª·¢ÖÜÆÚ£¬¶ø²»µÃ²»³¹µ×¼ì²éÒ»±é²¢ÐÞ¸ÄÊý°Ù¸öʹÓÃÁË include αָÁîµÄÒ³Ã棬ÕâÒ²ÊÇÒ»¼þÍ´¿àµÄÊÂÇé¡£ÎҵĽ¨ÒéÊÇ£¬ÔÚ²âÊÔÆÚ¼ä½ûÓÃä¯ÀÀÆ÷¸ßËÙ»º´æ¡£ÔÚ´ó¶àÊýÇéÐÎÏ£¬ÕâÑù×öÄܹ»³¹µ×½â¾öÎÊÌâ¡£Ò²Óм«ÉÙÊýÇéÐΣ¬ÕâÑù×ö²¢²»×àЧ£¬Õâʱ¿ÉÒÔÔÚä¯ÀÀÆ÷»ò·þÎñÆ÷Éϲ»¶ÏµØÖØÐÂÆô¶¯ Web ÈÝÆ÷À´È·±£²»½øÐиßËÙ»º´æ¡£
µ«ÊÇ£¬ÓÐʱºî£¬½øÐиßËÙ»º´æ»áµÃ²»³¥Ê§¡£Èç¹ûÌáÈëµÄÄÚÈÝÀ´×ÔʹÓö¯Ì¬Êý¾


Ïà¹ØÎĵµ£º

JSP±à³Ì½ø¶ÈÌõÉè¼ÆʵÀý

Ðí¶àWebÓ¦Óá¢ÆóÒµÓ¦ÓÃÉæ¼°µ½³¤Ê±¼äµÄ²Ù×÷£¬ÀýÈ縴ÔÓµÄÊý¾Ý¿â²éѯ»ò·±ÖصÄXML´¦ÀíµÈ£¬ËäÈ»ÕâЩÈÎÎñÖ÷ÒªÓÉÊý¾Ý¿âϵͳ»òÖмä¼þÍê³É£¬µ«ÈÎÎñÖ´ÐеĽá¹ûÈÔ¾ÉÒª½èÖúJSP²ÅÄÜ·¢Ë͸øÓû§¡£±¾ÎĽéÉÜÁËÒ»ÖÖͨ¹ý¸Ä½øÇ°¶Ë±íÏÖ²ãÀ´¸ÄÉÆÓû§¸Ð¾õ¡¢¼õÇá·þÎñÆ÷¸ºÔصİ취¡£
µ±JSPµ÷ÓÃÒ»¸ö±ØÐ볤ʱ¼äÔËÐеIJÙ×÷£¬ÇҸòÙ×÷µÄ½á¹û²»ÄÜ£¨ÔÚ·þÎñ ......

Ô¤±àÒëJSPµÄANT½Å±¾ (¼æÈÝtomcat5ºÍtomcat6)

<project name="jspToServletToClass" default="jsp2servlet2class" basedir=".">

<!-- set global properties for this build -->
<property environment="env" />
<property name="src" location="F:\JspC\src\" />
< ......

JSPÖÐÉú³É¶¯Ì¬XMLʵÀý

<?xml version="1.0" encoding="gb2312" ?>
<?xml-stylesheet type="tet/css" href="mystyle.css" ?>
<%@ page errorPage="error.jap" %>
<%@ page contentType="text/xml" %>
<realmarid>
»ÊÂí»¨Ãû²á
<athlete>
<name>Æë´ïÄÚ</name>
<country> ......

ServletÓëJSPÖÐÒ³ÃæÌøתµÄÇø±ð

Ò»Ö±¶ÔServletµÄ¼¸ÖÖÒ³ÃæÌøת·½Ê½£¬Àí½âµÄºýÀïºýÍ¿µÄ£¬½ñÌìÔÚÍøÉÏËÑÁËÒ»°Ñ£¬ÕÒµ½Ò»±é±È½ÏºÃµÄ£¬¼ÇÏÂÀ´£¬ÒÔºó¿´¿´¡£
  Ìøת·ÖÁ½²¿·Ö£¬Ò»ÊÇ·¢ÉúÔÚservlet£¬Ò»ÊÇÔÚJSP£¬ÆäʵJSPÒ²¾ÍÊÇservlet£¬²»¹ý»¹ÊÇÓеã²îÒìµÎ¡£
Servlet£º
µ±È»£¬ÔÚservletÖУ¬Ò»°ãÌøת¶¼·¢ÉúÔÚdoGet, doPostµÈ·½·¨ÀïÃæ¡£
1)  redirect · ......

JSP/XML,JavaBeanºÍCSS/XSLЭͬ¹¤×÷

1.ÔÚJSPÖÐÉú³É¶¯Ì¬XML
  ¿ÉÒÔʹÓÃJSPÉú³ÉXML,ʹÓÃCSS»òÕßXSLת»»ºÍÏÔʾXML;
  Ö»ÒªÔÚ¾²Ì¬µÄXMLÎĵµÄ£°åÖмÓÈëJava´úÂëºÍJSP±ê¼Ç£¬XML¾Í¿ÉÒÔÓо²±ä¶¯£¬²úÉú¶¯Ì¬µÄÄÚÈÝ£¬Éú³ÉXMLÎĵµµÄ·½·¨ºÜ¼òµ¥£¬Ö»ÐèÒªÔÚÎļþÖÐʹÓÃÖ¸Áîcontenttype,Èç<%@ page contenttype="text/xml"%>£»
  ÔÚXMLÎĵµÖÐͬÑù¿ÉÒÔʹ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ