JSP include command usage, jspinclude command
How to Use the include command of JSP
1. Syntax
<%@ include file="URL"%>
Code 2
1. date. jsp
<% @ Page language = "java" import = "java. util. * "contentType =" text/html; charset = UTF-8 "%> <% @ page import =" java. text. * "%> <% Date d = new Date (); SimpleDateFormat sdf = new SimpleDateFormat (" yyyy MM dd "); String s = sdf. format (d); out. println (s); %>
2. include_command.jsp
<% @ Page language = "java" import = "java. util. * "contentType =" text/html; charset = UTF-8 "%> <% String path = request. getContextPath (); String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/"; %> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
Test Results
If you have any questions, please leave a message or go to the community on this site for discussion. Thank you for reading this article. Thank you for your support!