Introduction to JSP development (IV)-Internal JSP objects

Source: Internet
Author: User

The last component related to JSP syntax is called an internal object. In a small JSP instruction file, you can access these internal objects to interact with the servlet environment that executes JSP pages. Access to many internal objects should be simplified. However, these are examples, and their access is acceptable. To fully utilize internal object settings, you need to understand the latest Java Servlet API.

The following table lists the internal objects you can use.

Internal Object Description

Request client request, which contains parameters from the get/POST request

Response returned from the response webpage to the client

The pagecontext page is managed here.

Session related to the request

Content being executed by application Servlet

Output stream used to send response

Config servlet architecture object

Page JSP page itself

Exception for the error webpage, exceptions not captured

So what are these, and how should you use them? Basically, in your small command file, you can use them to access and execute JSPProgramCodeServlet. To avoid talking about too many details about servlet APIs, let's examine what you can do with them:

Without expressions, you can directly access the internal out object to print something to response:

<% Out. println ("hello"); %>.

You do not need to directly transmit parameters to JavaBean. You can obtain the parameter values through the request object:

<% String name = request. getparameter ("name"); Out. println (name); %>.

After you write a lot of applications using JSP, If you create a JavaBeans or find that you put too many original Java codes into your JSP file, you need to create a supported Java category to encourage repeated use and reduce the time required for JSP page conversion. To create a Java class, you must:

Add the jdswk installation directory \ bin directory to your path. Add c: \ 1.2.2 \ bin; at the end of the path line of your autoexec. BAT file ;.

Run the following command to copy the JAR file to the \ JRE \ Lib \ ext directory:

Copy c: \ jswdk-1.0.1 \ Lib \ servlet. Jar c: \ jdk1.2.2 \ JRE \ Lib \ Ext.

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.