JSP has the following three categories of tags: directive: JSP Directive
Directive tags are used to set properties related to the entire JSP page.
The following three tags are the most frequently used
label |
JSP Tags |
Description |
<%@ page ...%> use comparison |
<jsp:directive.page attribute= "Value"/> |
Define dependency properties on a page, such as 脚本语言、页面编码、缓存需求 |
<%@ include:%> static inclusions, using more |
<jsp:directive.include file= "Relative url"/> |
Introduce other files, such as JSP, HTML, text files,先包含后运行 |
<%@ taglib ...%> reference label |
<jsp:directive.taglib uri= "uri" prefix= "Prefixoftag"/> |
Introduction of Tag library, can be JSP standard tag library (JSTL), can also be custom tag library |
Script:JSP Syntax[Not recommended!]
The
!--more-->
Syntax tag was earlier in Java designed to make it easier for developers to write business logic in JSP pages, but is no longer recommended.
label |
jsp label |
|
<% scriptlet%> |
<JSP:SCRI Ptlet> scriptlet </jsp:scriptlet> |
script program that can contain any valid Java statement, variable, method, or expression |
<%! declaration%> |
<jsp:declaration> Decl Aration </jsp:declaration> |
No, I don't know how to do this! Declaration statement, you can declare one or more variables, methods, for subsequent Java code to use |
<%= expression%> |
<jsp:expression> Express Ion </jsp:expression> |
|
<%–COMMENT–%> |
No, |
code comment, the page source does not display |
Code Description:
<body>
<%!String output ="world"; %>
<%out.println("Hello "+ output); %>
<br/>
<%="Hello "+ output %>
</body>
Good low code, although the combination of these three syntax tags, you can write a large segment of Java logic code in the JSP page, but it is strongly not recommended, because this will lead to the front page and business logic tightly coupled, so 后续难以维护
.
Action: JSP Action semi-retired state
function tags are predefined, well-defined behavior tags that are used occasionally.
label |
Description |
<jsp:include> |
Used to include static or dynamic resources in the current page.先运行后包含 |
<jsp:forward> |
Passing a JSP file from one file to another contains a 用户请求的 request 对象 请求转发 |
<jsp:useBean> |
Just not recommended to use, did not say abandoned! Find and initialize a JavaBean component |
<jsp:getProperty> |
Inserting the value of the JavaBean component into output |
<jsp:plugin> |
Used to include applets and JavaBean objects in the generated HTML page.个人用过一次,挺好玩的Applet,当年感觉很神奇 |
<jsp:element> |
Dynamically creating an XML element |
<jsp:forward> |
Passing a JSP file from one file to another contains a 用户请求的 request 对象 请求转发 |
<jsp:attribute> |
Defining properties for dynamically created XML elements |
<jsp:body> |
Defining the body of dynamically created XML elements |
<jsp:text> |
Used to encapsulate template data,有空看看,也许好玩呢!虽然我已经开始使用各种模版引擎了! |
From for notes (Wiz)
[Application] The second JSP comes with tag introduction