最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
jsp include两种调用形式详细
时间:2022-06-29 02:39:42 编辑:袖梨 来源:一聚教程网
include有两种形式,分别是Include指令:和include动作:jsp教程:include page="" flush="true"/>
include调用文件
,是将被引入的JSP与原JSP融合到一起,而这个融合过程是在翻译阶段进行的
index.jsp
Flavors
Our most popular flavors are:
Try them all!
flavor_list.html
- Chocolate
- Strawberry
- Vanilla
常当应用程序中所有的页面的某些部分(例如标题、页脚和导航栏)都相同的时候,我们就可以考虑用include。具体在哪些时候用,哪些时候用
include一个页面的地址
Flavors
Our most popular flavors are:
Try them all!
根据用户提交的参数请求,我们调用不用的文件
实例
// Diameter of the earth in kilometers
int distance = 12756;
%>
Diameter of the Earth in SI (Metric) Units
Diameter of the Earth in U.S. Customary Units
ShowDiameter.jsp
String dist = request.getParameter("dist");
if (dist == null)
throw new ServletException
("No distance parameter specified");int kilometers = Integer.parseInt(dist);
double miles = kilometers / 1.609344;String units = request.getParameter("units");
if (units == null)
throw new ServletException
("No units parameter specified");if (units.equals("SI")) {
%> Diameter = km }
else {
%> Diameter = miles }
%>
相关文章
- 小米万兆路由器和华硕ax86u pro哪个好(小米万兆路由器和华硕ax86u pro对比详解) 08-21
- 在国内稳定用Claude Code的三种姿势小结实用指南 08-21
- sketchup如何设计外墙内保温 08-21
- FigmaAI写独立书店海报提示词如何更贴合真人需求 08-21
- 保姆级教程:OpenClaw从入门到入土实用指南 08-21
- 影音转霸如何合并视频 08-21