JSP指令标签
    %@xxx% 通常放置在JSP头部,做说明性质的描述
    %@page%
    %@taglib% Jsp Standard Tag Library JSTL
    uri=”http://java.sun.com/jsp/jstl/core“ prefix=”c”
    %@include% 用来在当前JSP中引入已经写好的资源 .jsp .html

    index.jsp**

    1. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    2. <%@include file="test.jsp"%>
    3. <html>
    4. <head>
    5. </head>
    6. <body>
    7. 我是index.jsp
    8. </body>
    9. </html>

    test.jsp

    1. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    2. <html>
    3. <head>
    4. <script type="text/javascript">
    5. window.onload=function (){
    6. alert(111);
    7. }
    8. </script>
    9. </head>
    10. <body>
    11. 我是被引入的资源
    12. </body>
    13. </html>

    image.png
    image.png
    include标签引入一个HTML资源(产生中文乱码,即便设置了charset也不好用),为了解决这个问题,我们需要在web.xml中配置一些信息(第7、10行,其余代码为其他配置)

    1. <jsp-config>
    2. <jsp-property-group>
    3. <!-- 描述这个组是干什么的-->
    4. <discription>HTMLConfiguration</discription>
    5. <!-- 组名-->
    6. <display-name>HTMLConfiguration</display-name>
    7. <url-pattern>*.html</url-pattern>
    8. <!-- 默认为false-->
    9. <el-ignored>false</el-ignored>
    10. <page-encoding>UTF-8</page-encoding>
    11. <!-- 默认为false,同意脚本运行-->
    12. <scripting-invalid>false</scripting-invalid>
    13. </jsp-property-group>
    14. </jsp-config>

    JSP代码标签
    <%! %>
    <% %>
    <%= %>

    JSP动作标签 用来代替JSP中java创建对象,对象的赋值取值,请求参数,携带参数