JSP syntax introduction

xiaoxiao2021-03-06  54

Elements in the JSP page, explain: Three annotations, will print to the client, and the remaining two are ignored by the JSP engine. Second, template element: refers to the static HTLM or XML content in the JSP, which affects the structure of the page and theesthetics, but that is a business, it is unrelated to programmers. Third, scripting elements: including declaration, expression (Expression), and scriptlets, in addition to some minor differences, ScriptleTs can replace the first two functions. Fourth, instruction elements: JSP instructions are messages sent by JSP to the JSP package container. They are used to set the full game, such as class declarations, the way to implement, and output content types, etc., and do not generate any output to the customer. It only affects this JSP file. 1. Page instruction: Used to define and operate the properties of many important pages, these properties communicate with the JSP package container. Anywhere in JSP, in any order, one page can contain any number of PAGE instructions. However, in addition to the Import instruction, other instructions can only appear once. Several important PAGE instructions: <% @ page import = "java.io. *, Java.util. *"%> // Import package <% @ buffer = ""%> // Define buffering to customer output stream model. <% @ Info = ""%> // You can use servlet.getServletInfo () to get this string <% @ iSerrorPage = ""%> <% @ ErrorPage = ""%> / / JSP file can be used multithreaded using 2, include instructions: ASP is much more, then introduce it. 3, Taglib Directive: For details, please refer to the author Previous article "Custom Tag in Struts". V. The action element JSP action element is written in XML syntax, which is a response to the JSP runtime, which is active, and the response to the customer affects the JSP runtime. They should be provided by all bag containers regardless of their implementation. From the effect, a standard action is a tag that can be embedded in the JSP page. During the page is compiled as a servlet, when the package container encounters this tag, it is replaced with the Java code corresponding to the requesting predefined task. 1, : Provide additional information for other tags. It is used with , , . 2, If it is a static file, then just add the content to the JSP file, this file will not be executed by the JSP compiler, if it is a dynamic file, will be executed by the JSP compilation equipment. Theoretical <% @ Page Include = ""%> Differences with , I called it automatic refresh, but actually uses higher version of Tomcat, their function is the same.

Here is the sample code of this mark: <% @ page contenttype = "text / html; charset = GB2312" Language = "java"%> <% @ include file = "static.html"%> <% // just contains files into%> goto two ->
This Examples show include Works /> "/> ßthis is static.html>

Please Input Your Name:
Input You Password:
ßthis is a two.jsp -> <% @ page contenttype = "text / html; charset = GB2312" Language = "java"%> Example Include work Principle:
IS A1 = <% = Request.getParameter ("A1")%>
this is a2 = <% = Request.getParameter ("A2")%>
<% Out.println ("HEL Lo from two.jsp ");%> 3, is allowed to forward the request to another JSP, servlet, or static resource file. This action is particularly useful when converting to different views according to different requests.

转载请注明原文地址:https://www.9cbs.com/read-114114.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.057, SQL: 9