JSPÖж¯Ì¬INCLUDEÓ뾲̬INCLUDEµÄÇø±ð
ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
<%@ include file=" "%>
<jsp:include page=" " flush="true"/>
Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ.
ͨ³£µ±Ó¦ÓóÌÐòÖÐËùÓеÄÒ³ÃæµÄijЩ²¿·Ö(ÀýÈç±êÌâ¡¢Ò³½ÅºÍµ¼º½À¸)¶¼ÏàͬµÄʱºò,ÎÒÃǾͿÉÒÔ¿¼ÂÇÓÃinclude.¾ßÌåÔÚÄÄЩʱºòÓÃ<%@ include file=" "%>,ÄÄЩʱºòÓÃ<jsp:include page=" " flush="true"/>.ÕâÖÖÐÎʽ.Ê×ÏÈÒªÃ÷°×µÄÊÇËüÃÇÖ®¼äµÄÇø±ð.
<%@ include file=" "%>,jspµÄincludeÖ¸ÁîÔªËضÁÈëÖ¸¶¨Ò³ÃæµÄÄÚÈÝ.²¢°ÑÕâЩÄÚÈݺÍÔÀ´µÄÒ³ÃæÈںϵ½Ò»Æð.(Õâ¸ö¹ý³ÌÊÇÔÚ·Òë½×¶Î:Ò²¾ÍÊÇjsp±»×ª»¯³ÉservletµÄ½×¶Î½øÐеģ©.
ÕâÀï¶Ô·Òë½×¶Î½øÐÐÒ»ÏÂ˵Ã÷:ÎÒÃÇÖªµÀ,jspÒ³Ãæ²»ÄÜÔ·â²»¶¯µØ±»´«Ë͸øä¯ÀÀÆ÷,ËùÓеÄjspÔªËض¼±ØÐëÊ×ÏÈÓÉ·þÎñÆ÷½øÐд¦Àí.ÕâÊÇͨ¹ý½«jspÒ³Ãæת´ï»¯³Éservlet,È»ºóÖ´ÐÐÕâ¸öservletÀ´Íê³ÉµÄ.·þÎñÆ÷ÐèÒªÒ»¸öjspÈÝÆ÷À´´¦ÀíjspÒ³Ãæ.jspÈÝÆ÷ͨ³£ÒÔservletµÄÐÎʽÀ´ÊµÏÖ,Õâ¸öservlet¾¹ýÅäÖÃ,¿ÉÒÔ´¦Àí¶ÔjspÒ³ÃæµÄËùÓÐÇëÇó.
JspÈÝÆ÷¸ºÔð½«jspÒ³Ãæת»¯³Éservlet(³ÆΪjspÒ³ÃæʵÏÖÀà?JSP Page implementation class),²¢±àÒëÕâ¸öservlet.ÕâÁ½²½¾Í¹¹³ÉÁË·Òë½×¶Î.
ÓÉ´ËÎÒÃǾͻáÖªµÀ:jspÒ³ÃæÊÇ°ÑincludeÖ¸ÁîÔªËØËùÖ¸¶¨µÄÒ³ÃæµÄʵ¼ÊÄÚÈÝ(Ò²¾ÍÊÇ´úÂë¶Î)¼ÓÈëµ½ÒýÈëËüµÄjspÒ³ÃæÖÐ,ºÏ³ÉÒ»¸öÎļþºó±»jspÈÝÆ÷½«Ëüת»¯³Éservlet.¿ÉÒÔ¿´µ½Õâʱ»á²úÉúÒ»¸öÁÙʱclassÎļþºÍÒ»¸öjavaÎļþ.ÏÂÃæ¾Ù¸öÀý×Ó.
·þÎñÆ÷ÓÃtomcat,ÒýÈëÒ³ÃæµÄjspÎļþ½Ðtest.jsp.±»ÒýÈëµÄÒ³Ãæ½Ðdate.jsp.Õâ¸öjspÎļþÀï´æ·ÅµÄÊÇÒ»¸öÓйØʱ¼äµÄjsp´úÂë,µ±Ç°µÄÉÏÏÂÎĸùÉèΪtest
//======date.jspµÄÔ´Îļþ=====//
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<%
java.util.Date date=new java.util.Date();
String date_cn ="";
String dateStr = "";
switch(date.getDay())
{
case 0:date_cn ="ÈÕ"; break;
case 1:date_cn ="Ò»"; break;
case 2:date_cn ="¶þ"; bre
Ïà¹ØÎĵµ£º
jspÎļþÉÏ´«ºÍÏÂÔØ
package net.jspcn.tool;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* Title: ÎļþÉÏ´«Àà
* Description: ¼ÈÄܶÔÎļþ½øÐÐÉÏ´«,ÓÖÄÜÈ¡µÃÊäÈë¿òµÄÖµ,×î¶à¿ÉͬʱÉÏ´«255¸öÎļþ
* Copyright: Copyright (c) 2002
* Company: Tekson
* ......
ÏÂÃæÊÇjsp´úÂë<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="com.yourcompany.struts.action.Student" %>
<%@ t ......
À´Ô´ÓÚ¡¶Java¡¢javaEEÈí¼þ¹¤³Ìʦ¾ÍÒµÇóÖ°Êֲᡷ
1 HttpServletRequestÀàµÄrequest¶ÔÏ󣺴ú±íÇëÇó¶ÔÏó£¬Ö÷ÒªÓÃÓÚ½ÓÊÜ¿Í»§¶Ëͨ¹ýHTTPÐÒéÁ¬½Ó´«Êäµ½·þÎñÆ÷µÄÊý¾Ý¡£
2 HttpServletResponseÀàµÄresponse£º´ú±íÏìÓ¦¶ÔÏó£¬Ö÷ÒªÓÃÓÚÏò¿Í»§¶Ë·¢ËÍÊý¾Ý¡£
3 JspWriterÀàµÄout¶ÔÏó:Ö÷ÒªÓÃÓÚÏò¿Í»§¶ËÊä³öÊý¾Ý£¬OutµÄ»ùÀàÊÇJspWriter¡ ......
1 javascript £¬ÉèÖÃÒ»¸ö±äÁ¿£¬Ö»ÔÊÐíÌá½»Ò»´Î¡£
2 »¹ÊÇjavascript£¬½«Ìá½»°´Å¥»òÕßimageÖÃΪdisable
onsubmit="getElById('submitInput').disabled = true; return true;">
3 ÀûÓÃstrutsµÄͬ²½ÁîÅÆ»úÖÆ
......
¿ÉÄÜ´ó¶àÊýJsp¿ª·¢Ô±ÔÚдÍê³ÌÐò²âÊÔͨ¹ýºó£¬²»Ì«»á¹Ø×¢JspÉú³ÉµÄJavaÎļþ£¬Æäʵ£¬Í¨¹ýJava´úÂ룬¸üÄÜÌåÏÖ³ÌÐò´úÂëµÄÕæÕýº¬Ò壬¶Ô½øÒ»²½Ñо¿³ÌÐò´úÂëµÄºǫ́ÔËÐÐÇé¿öÊǷdz£ÓаïÖúµÄ¡£ÀýÈ磬ÓÃJsp±àд´úÂëʱ£¬ÓÐʱºòÓÃ<%! %>£¬ÓÐʱºòÓÃ<% %>£¬¼Ó²»¼Ó¸Ð̾º ......