注意:我无法将它们打包到 EAR 中。这里有一些限制。
我有 2 个 war 文件。
help.war 和 helpConnect.war
两者都放置在 GlassFish 服务器的同一域中。
从 help.war 的索引页面访问 helpConnect.war 中的页面,如下所示..
<a href="helpConnect/HelpInternal/index.htm">Help Internal</a>
这不起作用,因为当我尝试在服务器上访问时,它尝试访问的 URL 是这样的..
http://localhost:8080/help/helpConnect/HelpInternal/index.htm
但是,由于 helpConnect 是一个完全不同的 war 文件,我需要这样的 URL
http://localhost:8080/helpConnect/HelpInternal/index.htm
知道如何解决这个问题吗?
最佳答案
您正在使用相对路径。您需要一个绝对路径:
<a href="/helpConnect/HelpInternal/index.htm">Help Internal</a>
关于java - 从另一个 war 文件访问一个 war 文件的页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20186449/