Java Tutorial/JSP/Include — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:07, 1 июня 2010
Содержание
Include File
index.jsp
<source lang="java">
<%--
Copyright (c) 2002 by Phil Hanna All rights reserved. You may study, use, modify, and distribute this software for any purpose provided that this copyright notice appears in all copies. This software is provided without warranty either expressed or implied.
--%> <%@ page session="false" %>
Flavors
Our most popular flavors are: <%@ include file="flavor_list.html" %> Try them all!</source>
Include Page and Pass Parameter Through Request Object
index.jsp
<source lang="java">
<%--
Copyright (c) 2002 by Phil Hanna All rights reserved. You may study, use, modify, and distribute this software for any purpose provided that this copyright notice appears in all copies. This software is provided without warranty either expressed or implied.
--%> <%
// Diameter of the earth in kilometers int distance = 12756;
%> <%@ page session="false" %>
Diameter of the Earth in SI (Metric) Units
<jsp:include page="ShowDiameter.jsp" flush="true">
<jsp:param name="dist" value="<%= distance %>" /> <jsp:param name="units" value="SI" />
</jsp:include>
Diameter of the Earth in U.S. Customary Units
<jsp:include page="ShowDiameter.jsp" flush="true">
<jsp:param name="dist" value="<%= distance %>" /> <jsp:param name="units" value="US" />
</jsp:include></source>
Include Page by Path
<source lang="java">
<%--
Copyright (c) 2002 by Phil Hanna All rights reserved. You may study, use, modify, and distribute this software for any purpose provided that this copyright notice appears in all copies. This software is provided without warranty either expressed or implied.
--%> <%@ page session="false" %>
Flavors
Our most popular flavors are: <jsp:include page="/" flush="true"/> Try them all!</source>