<pre name= "code" class= "HTML" ><% @page import= "com.haitaiinc.dto.SysOper"%> <%@ page language= "Java" Contenttype= "text/html; Charset=utf-8 "pageencoding=" UTF-8 "%> <% @page import=" COM.HAITAIINC.SYS.FUNCTREE.TABDESC; %> <jsp:usebean id= "drug" class= "Com.haitaiinc.htdb.drug.dto.DrugClass" scope= "Request" ></jsp:usebean
> <jsp:scriptlet>//java scriptlet code System.out.println ("Here is the JSP scriptlet tag"); </jsp:scriptlet> <!--Knowledge Summary--> <!----------------------------------------------------1------------
------------------------------------------in the JSP, the most important part is the Scriptlet (script applet), all the Java programs embedded in the HTML code must be marked with Scriptlet.
There are 3 kinds of scriptlet code in the JSP. 1, <%%> in which you can define local variables, write statements, etc. 2, <%!
%> in which you can define global variables, methods, Classes 3, <%=%> The main function is to output a variable or a specific content, using the form of <%=%>, sometimes referred to as expression output. In a program where too much <%%> can cause code clutter, a scriptlet tag is provided in a new version of JSP that can be used to accomplish the same function as <%%>. The syntax for this label is as follows:--------------------------------------------------1---------------------------------------------------------------------------------------------------------2------------------- ------------------------------------page directives are important in JSP development, you can use this property to define the related properties of a JSP page.
Includes defining MIME types, defining packages that need to be imported, specifying error pages, and so on. 1, "@page language=" java "contenttype=" text/html;
Charset=utf-8 "pageencoding=" UTF-8 specifies that the development language to be used is Java, which is then set through ContentType, which is displayed as an HTML text file (text/html), and the page is encoded
(CharSet) is UTF-8. 2, "The @page errorpage=" "error.jsp"----This page, once there is an error, then jump to the error.jsp 3, "@page import=" Com.haitaiinc.sys.functree.TabDesc ;" "--------------------------------------------------2----------------------------------------------------------- ------------------------------------------------------------------------3-------------------------------------- -------------------------------------------@include instruction statically contains a static containing instruction that inserts a file containing text or code at the time the JSP compiles, and the process is static.
The included files can be JSP files, HTML files, text files, or a section of Java programs. The static inclusion syntax is the file path "%" to include in the%@ include file= use the Jsp:include directive to complete dynamically contained operations, unlike previous static inclusions, where dynamic include statements can automatically distinguish betweenWhether the included pages are static or dynamic.
If it is a static page, the content is included in the process as if it were static, and if the included page is a dynamic page, it can be processed dynamically before it is included in the processed result. The dynamically contained syntax is "Jsp:include page=" {The file path to include | "%= expression%}" flush= "True|false" explains: When the flush is set to false, the page is completely entered and then output. Within each JSP there will be a buffer, so if true, when the buffer is full output, this property is generally set to true--------------------------------------------------3-- -------------------------------------------------------------------------------
--------------------------------
------------------4---------------------------------------------------------------------------------JSP 9 built-in objects To simplify development, there are 9 built-in objects that will be instantiated by the container for the user and used directly, without having to instantiate the object through the keyword new, as in Java. Common: Request, response, session, application, PageContent 1-request object ===== Implementation =====>httpservletrequest (interface) ===== inheritance = =
==>servletrequest (interface) in web development, using requests to receive request parameters is the most common operation: (Receive form submission parameters) String content = request.getparameter ("info")
Single parameters can be received using GetParameter (), while a set of parameters is Getparametervalues (). There are two forms submitted by Get and post in HTML <from> tags, and there is an obvious difference: when you commit with GET, the content is displayed after the address bar;T commits, the content of the submission is not displayed on the address bar. 2-response Object 3-session 4-application 5-pagecontent--------------------------------------------------4------------ ---------------------------------------------------------------------
------------------------------------------
--------5---------------------------------------------------------------------------------JSP 4 attribute ranges The storage scope of 4 properties is provided in the JSP. The so-called property preservation scope, refers to is a built-in object, can son ah how many pages to save and continue to use.
Introduced as follows: page: Only one page to save the property, after the jump invalid "%//Set page property range, this property only in the current JSP page function Pagecontext.setattribute (" Syhua ", peony Flower);
% "Request: Save only once, server jump is still valid"%//Set the Request property range, this property only in the server jump function Request.setattribute ("Syhua", peony Flower);
Remove attribute String username = request.getattribute ("Syhua") from the request property scope;
% session: In a conversation scope, no matter which jumps can be used, but the new open browser is not available.
%//Set session property range, this property is always valid in a browser session.setattribute ("Syhua", peony Flower);
% "Application: saved on the entire server, available to all users." If you want to set a property so that all users (each session) can see it, you can set the property range to application so that the property is saved in the serviceOn the service device. --------------------------------------------------5------------------------------------------------------------ -----------------------------------------------------------------------6--------------------------------------- ------------------------------------------Cookie:cookie is a technique provided by browsers that enables server-side programs to store data that needs to be stored on the client, or processed at the client, Placed in the computer itself, without the transmission over the network. Thus, the efficiency of Web page processing is improved, and the load on the server side can be reduced.
However, because cookies are server-side information stored on the client, their security is also poor. --------------------------------------------------6------------------------------------------------------------ -----------------------> <!
DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >