简体   繁体   English

如何在.jsp页面上显示来自同一NAT中另一台计算机的图像?

[英]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. 想象一下,为客户端提供服务的第一个应用程序在192.168.88.2上运行,而第二个应用程序在192.168.88.3上运行。 I want those pictures to be visible on .jsp page of a 2nd application. 我希望这些图片在第二个应用程序的.jsp页面上可见。 (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. 目前,两个应用程序都在同一台计算机上运行,​​因此为了进行测试,我将图像存储在Web应用程序的src/main/webapp/images/目录中。

In Dispatcher-servlet.xml , i have the following lines of code: Dispatcher-servlet.xml ,我具有以下代码行:

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

Thanks. 谢谢。

It depends on where your application on server 1 publishes the images. 这取决于服务器1上的应用程序在何处发布图像。 On server 2 you just include them using 在服务器2上,您只需使用

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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