An analysis of Java learning JSP

Source: Internet
Author: User

First, what is JSP

JSP full name JavaServer Pages, is a technical standard that enables software developers to dynamically generate HTML, XML, or other format documents in a Web page that is co-created by Sunmicrosystems Company and many companies involved.

   Two, with servlet

        first say servlet a bit of a flaw: in servlet all html tags must be held in java http response will be very cumbersome; servlet You need to compile the changes to see the latest effects.

     and the difference is thatJSP:JSPprovides a simple set of labels toHTMLFusion,JSPyou can write directly in theHTMLcode, and you can see the effect immediately after you modify it. But there's no difference in their principles,JSPneed to be converted intoServeltcode to run again. JSPthe schematic diagram is as follows:


but Jsp also has its own shortcomings, the HTML and java Code written in a single page makes the entire page difficult to understand, so it is common to use Jsp and Servlet A combination of methods to complete a project (this piece of content is implemented in detail in a later blog)

third, built-in objects

JSP the built-in objects have 9 , in fact, these are not unfamiliar, have also been exposed to similar. However, there are four or five commonly used;


(i), interactive

1 , out : Used to output data to the client;

2 , Request : Encapsulates the user-submitted information, representing the request object, primarily for receiving clients through HTTP the protocol transmits data to the server side;

3 , Response : Represents the Response object, mainly used to send data to the client;

(b), error handling

Exception : Processing JSP errors and exceptions that occur when the file is executed are only available on the error page.

(iii) storage

1 , Session : The object is in the first JSP when the page is reprinted, it is automatically created to complete the session management; You can use the table to save each user's information

           2 , application : When the server starts, it automatically generates a application object, Each page of the site that the customer visits is the same application Directs the server to shut down, so all customers application objects are all the same.

3 , PageContext : Properties set in this object can only be taken from the current page

(iv) infrequently used

1 , page : Refers to the current JSP The page itself, to the class This Pointers

2 , Config : Represents JSP configuration information, but JSP pages typically do not need to be configured.


Summary: JSP is this time Java Learning in contact with a lot of a knowledge point, only recently slowly approached the MVC in JSP also plays a very important role, this is just a simple start.



 

Related Article

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.