JSP study Note 1

Source: Internet
Author: User

1.

<% --... -- %> Hide comments

<! --... --> Dynamic annotation, displayed in the document, and the JSP expression can be interpreted inside the comment;

2.

% Tomcat_home %/CONF/server. xml

<Context Path = "/book"

Docbase = "webapps/book">

</Context>

3.

Declaration <%! Declaration (s) %> has class, object scope

Expression <% = expression %> has a method scope. (An expression cannot end with a; sign)

The script applet <% scriptlet %> can also declare a variable here, and the variable has a method scope.

Considering the thread-safe relationship, local variables are declared first in the expression, and the declaration is usually used to declare Read-Only variables (final)

4.

Synchronize variables in JSP declarations or use a page command to set the isthreadsafe attribute to false

<% Synchronized (this ){

If (..){}

}

%>

5.

The difference between servletrequest. getrequestdispatcher andServletContext.getRequestDispatcher(java.lang.String)Is that this method can take a relative path.

6.

Getmoduleconfig (). findforwardconfig (string)

Response. senderror (httpservletresponse. SC _bad_request, getinternal (). getmessage ("noauthorized, mapping. getpath ()));

There are two ways to switch between sub-application modules. 1. Global or local <forward> element 2. Switchaction

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.