Home > Java > JavaBase > body text

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

王林
Release: 2019-12-18 11:15:50
Original
3226 people have browsed it

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"/>
Copy after login

is recommended to be replaced with

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

, 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\项目名
Copy after login

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");
Copy after login

2.jsp layer: <img src="${ map.pic }">This is the direct access address of the browser

3. Data layer storage

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

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!