简体   繁体   中英

How to display an image from another machine in the same NAT on a .jsp page?

I have two applications:

  1. for clients in which they send pictures than these pictures are stored on a disk
  2. for admin in which he/she may see the picture and based on it approve or not some action requested by client.

Imagine 1st application that serves clients is running on 192.168.88.2 and 2nd is on 192.168.88.3. I want those pictures to be visible on .jsp page of a 2nd application. (I know absolute paths of those pictures) how can display them?

As for now both applications run on the same machine so for the sake of testing i store images in src/main/webapp/images/ directory of my web appliction.

In Dispatcher-servlet.xml , i have the following lines of code:

<mvc:resources mapping="/images/**" location="/images/" />

Thanks.

It depends on where your application on server 1 publishes the images. On server 2 you just include them using

 <img src="https://192.168.88.2/path/to/the/image/file.jpg"/> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM