zoukankan      html  css  js  c++  java
  • JAVA-JSP之include指令

    相关资料:
    《21天学通Java Web开发》

    结果总结:
    1.包含的可以是一个HTML文件,也可以是一个文件文件,当然也可以是一个JSP文件。
    2.只有当被包含的文件执行完成后,JSP文件才会恢复执行。
    3.<%@ include file="被包含文件地址" %>
    4.include只有一个属性值,属性值为被包含文件的URL地址。
    5.在MyEclipse里写代码包含文件时提示出错,右击“WebRoot”-“Refresh”。
    6.发现包含的TXT文件中如果有中文出乱码,打开TXT-另存为-选择UTF-8。

    contenttxt.txt

    1 123ABC在不在?
    View Code

    contenthtml.html

    1 <h1> hello,world</h1>
    View Code

    contentjsp.jsp

    1 <%@ page import="java.util.*" %>
    2 <%=new Date() %>
    View Code

    实例代码:

     1 <%@ page language="java" pageEncoding="gb2312"%>
     2 <html>
     3 <head>
     4   <title>包含文本文件</title>
     5 </head>
     6 <body>
     7   <br>包含文本文件1,文件内容如下。<br>
     8   <%@ include file="contenttxt.txt"%>
     9   <br>包含HTML,文件内容如下。<br>
    10   <%@ include file="contenthtml.html"%>  
    11   <br>包含jsp,文件内容如下。<br>
    12   <%@ include file="contenthtml.html"%>  
    13 </body>
    14 </html>
    View Code
  • 相关阅读:
    1370
    1336
    1298
    1289
    Buy Tickets(poj2828)
    The Balance(poj2142)
    1067
    Lightoj1011
    1319
    Back to Underworld(lightoj 1009)
  • 原文地址:https://www.cnblogs.com/FKdelphi/p/7449613.html
Copyright © 2011-2022 走看看