jsp指令和动作元素

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_40883132/article/details/81873589

include 指令:

 <%@ include file="/test.jsp" %>

test.jsp

<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %><%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2018/8/20
  Time: 16:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Test</title>
</head>
<body>
<%
    Date date = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
    out.print(sdf.format(date));
%>
</body>
</html>

include 动作:

<jsp:include page="/test.jsp">
        
    </jsp:include>

inlcude指令是将两个页面的代码放在一起了,包括servlet.而include动作则没有。

可以通过查看源代码知晓。

forword指令和param:

 <jsp:forward page="list.jsp">
       <jsp:param name="name" value="哈哈"></jsp:param>
   </jsp:forward>

跳转页面,param参数,如果提交过来的已经存在了,则作为修改,否则,为新增。 

猜你喜欢

转载自blog.csdn.net/qq_40883132/article/details/81873589