JSP syntax (3)

xiaoxiao2021-03-06  71

Page instruction defines global properties in the JSP file. JSP syntax <% @ page [language = "java"] [extens = "package.class"] [import = "{package.class | package. *}, ..." ] [Session = "true | false"] [buffer = "none | 8KB | SIZEKB"] [Autoflush = "true | false"] [isthreadsafe = "true | false"] [info = "text"] [errorpage = " "[contenttype ="] ["tEXT / HTML; Charset = ISO-8859-1"] [ISERRPAGE = "true | false"]%> example <% @ page import = "java . - "%> <% @ page buffer =" 5kb "autoflush =" false "%> <% @ Page ErrorPage =" Error.jsp "%> Description <% @ Page%> instruction The entire JSP page also includes static include files. But <% @ page%> The instruction does not act on dynamic containing files, such as You can use multiple <% @ PAGE%> instructions in a page, but the properties can only be used once, but There is also an exception, that is the import property. Because the Import property and the Import statement in Java are almost (refer to Java Language), you can use this property a few times. Whether you put <% @ Page%> instructions in JSP files, its role range It is the entire JSP page. However, for the readability of the JSP program, and good program habits, it is best to put it on the top of the JSP file. Attribute language = "java" declares the type of scripting language, temporarily only "java" extends = " Package.class "Missing the full name of the Java Class, which needs to be added, but you can use it with caution, which will limit the compilation power of JSP. Import =" {package.class | package. *}, ... " A list of imported Java packages, these packages act on blocks, expressions, and declarations. The following packages have been imported at JSP compile, so you don't need to specify: java.lang. * Javax.servlet.jsp. * Javax.servlet.http. * Session = "true | false "Set whether the customer needs http session. (Soced with ASP, it should be unfamiliar with it) if it is true, then Session is useful.

If it has false, then you can't use the Session object, and define the element of Scope = Session. Such use can cause errors. The default is true. Buffer = "None | 8KB | SIZEKB" Buffer size is used by OUT objects to process the executionful JSP to the client browser output. The default is 8KB autoflush = "true | false" setting If the buffer overflows, if it is necessary to force the output, if its value is defined as true (default), the output is normal, if it is set to false, if this buffer overflows, It will cause an unexpected error. If you set the buffer to none, you can't set autoflush to false. Isthreadsafe = "true | false" Set whether the JSP file can be used multithreaded. The default value is true, that is, JSP can handle a request for multiple users at the same time. If set to false, a JSP can only process a request info = "text" once in execution JSP will be joined JSP In, you can retrieve it using the servlet.getServletInfo method. ErrorPage = "RelativeURL" Sets the JSP file that handles exception events. ISERRORPAGE = "true | false" Set whether this page is an error page, if you are set to true, you can use the Exception object. ContentType = "MimeType [; charset = characterset]" | text / html; charset = ISO-8859 -1 "Set the MIME type. The default MIME type is: text / html, the default character set is the ISO-8859-1.taglib directive defines a prefix on its custom label. JSP syntax <% @ Taglib URI = "uritotaglibrary" prefix = "tagprefix "%> Example <% @ taglib URI =" http://www.jspcentral.com/tags "prefix =" public "%> .. Description <% @ taglib%> The instruction declares that this JSP file uses a custom label, and references the label library, also specifies the prefix of their label. The custom label here contains tags and elements. Because the JSP file can be converted to XML, it is important to understand the connection between the label and elements. The label is just a mark that is raised in a sense, which is part of the JSP element. The JSP element is part of the JSP syntax, and the start tag and end tag are the same as XML. Elements can also contain other texts, tags, and elements.

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

New Post(0)