${pagecontext.request.contextpath} jsp gets absolute path

Source: Internet
Author: User

You can use ${pagecontext.request.contextpath} when you use it, and you can use <%=request.getcontextpath ()%> to achieve the same effect, and you can also ${ PageContext.request.contextPath}, put in a JSP file, will be placed in a variable with c:set, and then use the EL expression to take out.

Such as:

1 <c:set var= "CTX" value= "${pagecontext.request.contextpath}"/>
2 <c:set var= "Resources" value= "${pagecontext.request.contextpath}/resources"/>

The EL expression takes a variable method:

Variable
The EL Access variable data method is simple, for example: ${username}. It means to take out a variable whose name is username in a range.
Because we do not specify a range of username, it will be searched sequentially from page, Request, Session, application range.
If the way to find username, direct callback, no longer continue to find, but if all the scope is not found, the return null.

Reference: http://www.cnblogs.com/langtianya/archive/2013/03/04/2942515.html

http://blog.csdn.net/qwerasdf123/article/details/4189889



${pagecontext.request.contextpath} jsp gets absolute path

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.