Home  >  Article  >  Java  >  The picture of the project accessed under the url in java is not displayed

The picture of the project accessed under the url in java is not displayed

王林
王林Original
2019-12-18 11:15:503240browse

The picture of the project accessed under the url in java is not displayed

img tag: The following

<img  src="http://localhost:8080/MyThreeWeb/image/upload/62f392ba466e40db84f78302e727db35_Koala.jpg"/>

is recommended to be replaced with

<img  src="/MyThreeWeb/image/upload/62f392ba466e40db84f78302e727db35_Koala.jpg"/>

, which is the specific path to access this project starting from the project name.

Related video tutorial sharing: java online video

If the browser directly accesses it, please check whether the image is included in the actual deployed container.

For example: tomcat in eclipse

工作区间\.metadata\.plugins\org.eclipse.wst.server.core\tmp数字【数字代表是第几个创建的项目,从0开始】
\wtpwebapps\项目名

Then check whether the specific image of the path is generated.

The specific operation is:

1.controller layer: the saving directory of uploaded files:

String savePath = this.getServletContext().getRealPath("image/upload");

2.jsp layer: dcbad98247c32215bdd09096c2a489deThis is the direct access address of the browser

3. Data layer storage

http://localhost:8080/MyThreeWeb/image/upload/62f392ba466e40db84f78302e727db35_Koala.jpg

Recommended related articles and tutorials: Getting started with java

The above is the detailed content of The picture of the project accessed under the url in java is not displayed. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn