JSP instructions for JSP entry primary tutorial

xiaoxiao2021-03-06  15

The overall structure of the servlet class

It affects the overall structure of the servlet class. It often uses the following form:

<% @ Directive Attribute = "Value"%>

Moreover, you can write multiple properties in a statement:

<% @ Directive Attribute1 = "Value1" Attribute2 = "Value2" Attributen = "VALUEN"%>

There are two main Directive:

Page, allowing you to do something similar to Import Classes, define the superclass of the servlet,

MSO-HANSI-FONT-FAMILY: ""> etc;

Include, allow you to insert files into the servlet class (when JSP file is translated into servlet).

First, JSP Page Directive

grammar:

<% @ Page = "java"] [EXTENDS = "package .class"] [import = "{package .class |. *}, ..."] [session = "true | false] [buffer = "None | 8KB | SIZEKB"] [Autoflush = "true | false"] [isthreadsafe = "true | false"] [info = "text"] [errorpage = "relativeurl"] [ContentType = "mimeType [; charSet = characterset ] "|" Text / HTML; Charset = ISO-8859-1 "] [ISERRPAGE =" True | False "]%>

Page Directive MSO-Hansi-font-family: "" Allows you to define some case-sensitive properties:

(1) Import = "package.class" or import = "package.class1, .., package.classn".

MSO-Hansi-Font-Family: "">

You can try your IMPORT package. E.g:

<% @ Page Import = "java.util. *"%>

The IMPORT property is the only one in these properties that can occur multiple times in a JSP.

(2) ContentYpe = "mime = type" or contenttype = "mime-type; charSet = character-set" mso-hansi-font-family: "">>

It specifies the output MIME type. The default is "Text / HTML". E.g:

<% @ Page ContentType = "Text / Plain"%> "in Scriptlet Medium price:

<% Response.setContentType ("text / plain");%>

(3) iSthreadsafe = "true | false". If the value is "true" indicates that ordinary servlet processing, multiple requests will be handled in parallel by a servlet instance, in which case the programmer synchronization Access multiple instance variables. When the value is "false", it means that the servlet will implement single-threaded modhmodel, regardless of whether the request is sequential or concurrent, and will provide different separation servlet instances.

(4) Session = "True | FALSE". If the value is "true" (default) indicates that the predefined variable session should be bound to an existing session, otherwise it should be created and bind it. When the value is "false", it means: If the session variable will not be used, if you try to use, an error will occur when the JSP is converted to servlet.

(5) Buffer = "sizekb | none". Output the size of the buffer to the JSPWriter. The default is determined by the server, but at least 8KB.

(6) Autoflush = "True | FALSE". If the value is "True Mso-Hansi-Font-Family:"> "(default) indicates that it will be automatically emptied when it is buffered, the value is" false mso-hansi-font-family: ">" means: ">" Exercise an exception when it is built, which is rarely used. When buffer = "none" is not legal if you use false mso-hansi-font-family: "">.

(7) Extends = "package.class". This will create a superclass for the servlet. Please use this feature special carefully because the server may have defined one.

(8) Info = "message". Define a string that can be obtained by calling the GetServletInfo method.

(9) ErrorPage = "URL". Specify a JSP MSO-Hansi-Font-Family: "" page to handle any accidental errors that can be thrown but the current page is not processed.

(10) iSerrorPage = "True | FALSE". Specifies whether the current page can handle errors from another page, default is "false".

(11) Language = "Java" MSO-Hansi-font-family: "">. It is pointed out the language below will be used. However, it is not necessary for this property, because "Java Mso-Hansi-Font-Family:"> "is the only legal choice for the default.

Two JSP Include Directive This Directive allows you to include a file when JSP is converted to servlet. grammar:

mso-hansi-font-family: "; mso-font-kerning: 0pt"> or } "/> URL MSO-HANSI-FONT-FAMILY: ""> It is usually relative to its JSP page, however, the relative "URL" is commonly used, you can use a slash "/" as the beginning of the URL to inform the system URL MSO- Hansi-font-family: ""> The main path of the relative web server. The file being included will be parsed in a rule of JSP, so you can use static HTML, Scripting Elements, Directives, and Actions.

Let's take an example, and many sites contain a small navigation bar on each page. It usually appears on the top or left and right side of the page and is included in each page. This is very natural with include Directive. If you use the rule of HTML MSO-HANSI-FONT-FAMILY: "", it is undoubtedly a dream. Please see the following code:

JSP tutorial </ title> </ head> <body> <% @ include file = "/ navbar.html"%> <! - Distinguished section of this page ... -> </ Body> </ html></p> <p>Because the file is inserted when the page is converted, so if the navigation strip changes, you need to re-compile all the JSP MSO-Hansi-font-family: ""> pages that point to it. If your navigation bar does not often change this, it is undoubtedly efficient, but if your containment file changes frequently, it is recommended that you use JSP: Include Action to replace it, it is requested at the page. Only the file is included.</p> <p><% @ Directive Attribute = "Value"%></p> <p>Moreover, you can write multiple properties in a statement:</p> <p><% @ Directive Attribute1 = "Value1" Attribute2 = "Value2" Attributen = "VALUEN"%></p> <p>There are two main Directive:</p> <p>Page, allowing you to do something similar to Import Classes, define superclass, mso-hansi-font-family: "", etc .;</p> <p>Include, allow you to insert files into the servlet class (when JSP file is translated into servlet).</p> <p>First, JSP Page Directive</p> <p>grammar:</p> <p><% @ Page = "java"] [EXTENDS = "package .class"] [import = "{package .class |. *}, ..."] [session = "true | false] [buffer = "None | 8KB | SIZEKB"] [Autoflush = "true | false"] [isthreadsafe = "true | false"] [info = "text"] [errorpage = "relativeurl"] [ContentType = "mimeType [; charSet = characterset ] "|" Text / HTML; Charset = ISO-8859-1 "] [ISERRPAGE =" True | False "]%></p> <p>Page Directive MSO-Hansi-font-family: "" Allows you to define some case-sensitive properties:</p> <p>(1) Import = "package.class" or import = "package.class1, .., package.classn".</p> <p>MSO-Hansi-Font-Family: ""></p> <p>You can try your IMPORT package. E.g:</p> <p><% @ Page Import = "java.util. *"%></p> <p>The IMPORT property is the only one in these properties that can occur multiple times in a JSP.</p> <p>(2) ContentYpe = "mime = type" or contenttype = "mime-type; charSet = character-set" mso-hansi-font-family: "">></p> <p>It specifies the output MIME type. The default is "Text / HTML". E.g:</p> <p><% @ Page ContentType = "Text / Plain"%> "</p> <p>Medium price in Scriptlet:</p> <p><% Response.setContentType ("text / plain");%></p> <p>(3) iSthreadsafe = "true | false". If the value is "true" indicates that ordinary servlet processing, multiple requests will be handled in parallel by a servlet instance, in which case the programmer synchronization Access multiple instance variables. When the value is "false", it means that the servlet will implement single-threaded modhmodel, regardless of whether the request is sequential or concurrent, and will provide different separation servlet instances.</p> <p>(4) Session = "True | FALSE". If the value is "true" (default) indicates that the predefined variable session should be bound to an existing session, otherwise it should be created and bind it. When the value is "false", it means: If the session variable will not be used, if you try to use, an error will occur when the JSP is converted to servlet. (5) Buffer = "sizekb | none". Output the size of the buffer to the JSPWriter. The default is determined by the server, but at least 8KB.</p> <p>(6) Autoflush = "True | FALSE". If the value is "True Mso-Hansi-Font-Family:"> "(default) indicates that it will be automatically emptied when it is buffered, the value is" false mso-hansi-font-family: ">" means: ">" Exercise an exception when it is built, which is rarely used. When buffer = "none" is not legal if you use false mso-hansi-font-family: "">.</p> <p>(7) Extends = "package.class". This will create a superclass for the servlet. Please use this feature special carefully because the server may have defined one.</p> <p>(8) Info = "message". Define a string that can be obtained by calling the GetServletInfo method.</p> <p>(9) ErrorPage = "URL". Specify a JSP MSO-Hansi-Font-Family: "" page to handle any accidental errors that can be thrown but the current page is not processed.</p> <p>(10) iSerrorPage = "True | FALSE". Specifies whether the current page can handle errors from another page, default is "false".</p> <p>(11) Language = "Java" MSO-Hansi-font-family: "">. It is pointed out the language below will be used. However, it is not necessary for this property, because "Java Mso-Hansi-Font-Family:"> "is the only legal choice for the default.</p> <p>Two JSP Include Directive This Directive allows you to include a file when JSP is converted to servlet. grammar:</p> <p><JSP: Include Page = "{RelativeURL | <% = Expression%>}" Flush = "true" /> mso-hansi-font-family: "; mso-font-kerning: 0pt"> or <JSP: include Page = "{relativeurl | <% = expression%>}" Flush = "true"> <jsp: param name = "parameters" value = "{parameter" value | <% = expression%>} "/> </ jsp: incrude ></p> <p>URL MSO-HANSI-FONT-FAMILY: ""> It is usually relative to its JSP page, but the relative "URL" is commonly used, you can use a slash "/" as the beginning of the URL URL MSO-Hansi -Font-Family: ""> The main path of the relative Web Server. The file being included will be parsed in a rule of JSP, so you can use static HTML, Scripting Elements, Directives, and Actions. Let's take an example, and many sites contain a small navigation bar on each page. It usually appears on the top or left and right side of the page and is included in each page. This is very natural with include Directive. If you use the rule of HTML MSO-HANSI-FONT-FAMILY: "", it is undoubtedly a dream. Please see the following code:</p> <p><Html> <head> <title> JSP tutorial </ title> </ head> <body> <% @ include file = "/ navbar.html"%> <! - Distinguished section of this page ... -> </ Body> </ html></p> <p>Because the file is inserted when the page is converted, so if the navigation strip changes, you need to re-compile all the JSP MSO-Hansi-font-family: ""> pages that point to it. If your navigation bar does not often change this, it is undoubtedly efficient, but if your containment file changes frequently, it is recommended that you use JSP: Include Action to replace it, it is requested at the page. Only the file is included.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-45895.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="45895" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.032</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'ze5rn_2FUrVJ3M_2FDIeqrjCjeat8UBZkFjLUCPQapBER4EVdOqN191gd3bOPD0nn9ijJlNHRMR2d_2FM_2BhD8Uu7GnVg_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>