JSP path error, jsp path

Source: Internet
Author: User

JSP path error, jsp path

1. Error description



2. Error cause

<% @ Page language = "java" import = "java. util. * "pageEncoding =" UTF-8 "%> <% String path = request. getContextPath (); String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/"; %> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN"> 

3. Solution

Delete the following statements:

<%
String path = request. getContextPath ();
String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/";
%>


<Base href = "<% = basePath %>">


Jsp Path Problems

Reference jsp using a relative path can be referenced, but css and js are all started from the root path. You can compare your page and code by yourself, check whether lyboss is the first folder in the root path.

An error occurred while reading the image path in jsp.

Amount... It was blocked again and wanted to be ma.
First, for server and client problems, do not place the server path on the client unless you only run it on one computer.
Second, the out is a built-in jsp object and should be placed in <%>
Third, third, the highest access path of the web project is webRoot. If it exceeds the maximum access path, it cannot be accessed. This design is designed for the sake of website security. Otherwise, you will know the path, and you can control everything on the server. Therefore, you D :\, cannot be parsed in the browser. It only has webRoot as the root directory.
Solution: Put the image in the webRoot folder and access it through the/file 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.