JSP self-study notes

zhaozj2021-02-11  240

JSP Note <% -%> Note <% - -%> -%> should be written as -% /> JSP declaration <%! Declaration statement sequence%> Class and variable You can declare a method in <%!%>, You can also directly declare a method <%! Public void foo () {outputln ("the foo function");}%> JSP expression <% = Java expression%> Used to display the value of the expression directly in the page, the effect and <% uniform JSP block <% Java Code%> The variables declared in the JSP declaration is valid in all the thread running this JSP program code. The declared variables in the segment will recreate and reinitialize the basic format <% @ Directive {attr = "value"}%> now only three JSP compilation instructions now include only three JSP compilation instructions, Page, Taglib Include Compile Instruction You can embed an external file into the current JSP program, and resolve the JSP statement in this file (if any) format: <% @ include file = "relativeURLSPEC"%> Example: <% @ Include file = "Copyright.html"%> If the embedded file is often changed, it is recommended to use the Operation Instruction Page Compile Instructions <% @ page [language = "java"] [eXtens = "package.class" ] [Import = "package. *}, ..."] [session = "true│false"] [buffer = "none│8KB│Size KB"] [Autoflush = "True│FALSE"] [isthreadsafe = "True│FALSE"] [INFO = "TEXT"] [ErrorPage = "RelativeURL"] [ContentType = "Mimetype [; charset = characterset]" │ "Text / HTML; Charset = ISO8859.1"] [ISERRORPAGE = "TRUE │FALSE "]%> Description: Language: Declare the type of teaching language in the current JSP program: indicating that The JSP program is compiled with the Java class that needs to inherit the Class or the fully named Import: Used to import the package. The following packages are automatically imported when the following packages are automatically imported, and it is not necessary to explicitly represent java.lang. *; Javax .Servlet. *; javax.servlet.jsp *; javax.servlet.http. * Case: <% @ page import = "java.util.vector"%> session: Set whether the JSP program requires http session buffer: specified Output the size of the buffer.

Output buffer is used by the JSP internal object -Out Object (OUT) for cache executable JSP programs to the client browser output, the default value 8kb, can be set to NONE, or other value, unit is KB Autoflush : Specifies whether or not to force the output buffer if the output buffer overflows. It is normal when set to TRUE. When set to false, an Exception is generated when buffer overflows. Example: <% @ Page Buffer = "5KB" Autoflush = "false"%> INFO: Setting the JSP program information, can also be considered as indicated, can be retrieved by servletContext.getServletInfo () method: Specify Error Processing program. If this program produces an exception or error, the JSP program does not have a corresponding processing code.

The external handler example specified by the instruction is automatically called: <% @ Page ErrorPage = "../ error / errorpage.jsp"%> iserroepage: Setting this JSP program is an error handler ContentType: used to set the pass Back to the webpage format and code style, namely the MIME type and page character set type default MIME type is text / html; the default character set is ISO-8859.1: <% @ page contenttype = "text / html; charSet = GB2312 "%> Taglib compiled instruction format: <% @ Taglib Uri =" taglibraryuri "Perfix =" tagprefix "%> This and XML is related to the JSP operation command is different from JSP compilation instructions, the JSP operation instruction is on the client The following is the following: , , , , , 1, Role: Currently redirect other HTML files, or other dynamic program grammar form: } "/> JSP1.0) or (JSP1.1 / 1.2) {} Page = "{relativeurl│ <% = expression%>}" Specifies the URL set parameters: example: 2, Role: Specify the value of a parameter, you must use the , , , etc., together with the 3, instruction role. : In the JSP program, a static or dynamic file syntax form: or flush = "true": Specify whether it will be treasure The execution result of the file is output to the client, and flush = "false" is not allowed in the JSP1.1 specification is the example: : 4, Role: Dynamic Download Server JavaBean or Java Applet program to execute if needed, if needed, please also download a Java plugin syntax: < jsp: plugin type = "bean│applet" code = "classFileName" codebase = "classFileDiretoryName" [name = "instanceName"] [archive = "URLtoArchive"] `[align =" bottom│top│middle│left│right "] [heigh = "displayPixels"] [width = "displayPixels"] [hspace = "leftRightPixels"] [vspace = "topBottomPiexels"] [jreversion = "JREVersionNumber│1.2"] [nspluginurl = "URLToPlugin"] [iepluginurl = "URLToPlugin" ]> [ [JSP: Param Name = "ParameterName" Value = "ParameterValue" />] ] [ Text Message for User That Can No See The Plugin ] Description: Type Specifies the type code of the Java program executed to specify the file name being executed, the file must be "

.CLASS "Extended Name CodeBase Specifies the Directory Name of the executed file to the program to mark the program Archive points to some paths of the class to be used in advance, vSpace: display, left and right, The Up and down white Jreversion can run the JRE version required to run, the default value is 1.2 nsplugin, IEPLUGIN: Netscape Navigator, Internet Exploer can use the JRE download address instruction: used to display Example of information: Have a meal with his girlfriend and then play his girlfriend.

I took a hair, now the handsome continuation write example

Unable to load plugin example: Plugin Tag Dbject or Embed Not Supported by Browser Role: Used to instantiate one or several JavaBean Value for specifying a property of JavaBean is used to output a value format for a attribute in javabean: where id is the name of the JavaBean class class class scope SCOPE for this instance object beandetails: = Class =" classname "│ class =" classname "│ class =" classname " TYPE = "TypeName" │ beanname = "beanname" type = "type" │ type = "TYPE Name " in which protydetails: = proteTYDETAILS: = Property =" * "│PROTERTY =" PropertyName "param =" parametername "If the value of Property is" * ", this shows if the property of form data Name and Javabean's attribute names The same name, the corresponding attributes of JavaBean will be automatically assigned

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

New Post(0)