Java Web Learning Note (ii)

Source: Internet
Author: User

CSS: That is (cascading) style sheets, a technology to beautify the page, you can easily and flexibly set the appearance of different elements of the page properties.

positioning properties in CSS:

(1)position: positioning, divided into absolute positioning (absolute), relative positioning (relative), static positioning (statics);

(2) Horizontal axis:left, ordinate:top;

(3) Width:width, height:height;

(4)overflow: definition of the content beyond the processing method;

(5)Z-index: Define the stereoscopic effect;

(6)visbility: Definition of visibility,Visible/hidden;

In essence,jsp is the Java code nested in the HTML , and then through the JSP container compilation execution, can be based on the running results of these dynamic code to generate corresponding HTML Code, so support multi-platform.

operation mechanism: If the JSP page is requested to run for the first time, the JSP compiler of the server generates the Java code corresponding to the JSP page and compiles it into a class file When the server requests this JSP page again, it will determine if the JSP page has been modified, if it is modified, it will regenerate the new Java code and compile it into a new class file, and replace the original class file, if it has not been modified, The previous class file is called directly ( the entire process is done by the server by the JSP page code to the class file).

A.JSP File: Add at the beginning of the file

<%@ page language = "java" import = "java.util.*" ContentType = "Text/html;charset = gb2312"%>

JSP action command:

(1),include action directives: The difference from the include directive: the former can dynamically contain a file (content can be static files or dynamic scripts, and when dynamic scripting changes,JSP The engine will dynamically compile the update), or simply combine a file into a file;

use format:<jsp:include flush = "true" page = "Example.txt" ></jsp:include>

(2),forward Action command: Used to control the page redirection, that is, from the current page to jump to the corresponding page;

<jsp:forward page = "URL" ></jsp:forward>;

the difference between the Forward action directive and the <a></a> hyperlink tag:

on the one hand: everything in the former can be used Java code to control, you can directly determine the program in the direction of the page jump and timing, the latter only when the connection is clicked to jump;

On the other hand:Forward/param The address bar remains the same when implementing the jump and pass parameters, and the parameters are not displayed in the Address bar, <a></a> When a hyperlink tag jumps and passes parameters, the parameters are not displayed in the address bar (some browsers encode the parameters, and some directly display them).

(3),param Action instructions: with the use of forward, to achieve in the jump at the same time transfer parameters;

use format:<jsp:param name = "param" value = "Test"/>

(4),<jsp:plugin> action instruction: used to play or display IgE objects in the browser (typically applets and beans) , requires the browser has a JAVA plugin;

remark:Applet: That issmall applications, usingJavaa program written in a programming language that can be included in the HTML(one application of the standard Universal Markup Language page, which is approximately the same way that you include images in a page. Contain appletsof the Web pageHTMLfile code in the middle with <applet>and the</applet>such a pair of tokens, when supportedJavaof Networkwhen the browser encounters this pair of tokens, it downloads the appropriate applet code and executes it on the local computer.applets. Java Appletis to useJavalanguage written by someSmall Applications , these programs are embedded directly into the page, supported by Javaof theBrowser(IEorNetscape)explain the execution of programs that produce special effects. It can greatly improve Webthe ability to interact with the page and execute dynamically. IncludeappletsThe Web page is calledjava-poweredpage, which can be referred to asJavasupported Web pages.

( 5 usebean action instruction: in Span style= "font-size:13px;font-family:arial, ' Sans-serif '; color: #333333; background: #FFFFFF;" >jsp javabean

Use format: <jsp:usebeanid = "class =" "Scope = " "></jsp:useBean>

The name of the instance objectwith Id JavaBean, class is the package path for the JavaBean class, contains the package name and class name,and scope is the JavaBean valid range, there are page/request/session/application four values to choose from.

(6),setProperty action instruction: with the JavaBean , used to assign value to the JavaBean instance object;

use format:<jsp:setproperty name= " instance object name " property= " property name " Value= " property value "/>

or <jsp:setproperty name= " instance object name " property= "*"/>

(7),getProperty action instruction: used in conjunction with JavaBean, used to remove The property value of the JavaBean instance object;

use format:<jsp:gettproperty name= " instance object name " property= " property name " Value= " property value "/ >

JSP directive:

(1),page directive: Used to define the global properties of JSP pages;

(2),include directive: static contains a file;

A built-in object for JSP: Object instances that can be used directly without declaration, commonly used:request,response,session, out,application and so on.

The Request object: Represents the requests sent from the user, from the middle of the object can be removed from the user submitted data or parameters, that is, in the process of interacting with the user, to learn the user's needs (from the user input data and parameters), at the same time, The object also includes some server information (such as port, real path, access protocol, etc.);

the Main method of Request:

(1) getattribute (String name): Gets the value of the specified property;

(2) Getcontexntpath (); Gets the path to the server context;

(3) getcookies (); Obtain client's Cookies;

(4) GetHeader (String name); gets The attribute value of the specified HTTP header;

(5) getparameter (String name); Gets the parameters that the client submits to the server;

(6) getservername () Gets the name of the server;

(7) getserverport (); Gets the access port of the server;

(8) setAttribute (String name,objecto); Assign value to the specified property value

(9) remoteattribute (String name); Remove the specified property;

(Ten) getremoteaddr (); Gets the IP address of the client machine ;

This article is from the "book Notes" blog, please be sure to keep this source http://xiexiao.blog.51cto.com/10173801/1651878

Java Web Learning Note (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.