我正在尝试使用 <c:import>
将一个页面嵌入到另一个页面中我遇到了困难。
如果我使用<c:import url="http://www.google.com" />
一切都很好。
我正在尝试加载本地路由:
@RequestMapping(value="/modules/some_module/{customerId}/bill", method=RequestMethod.GET)
使用:
<c:import url="/modules/some_module/SOME_CUSTOMER_ID/bill" />
但我什么也没得到。我加载简单 jsp
没有任何问题使用相对路径的文件。
我怀疑,你不能使用相对路径加载路由吗?在这种情况下,有没有一种简单的方法来检索和附加协议(protocol)/域?
最佳答案
如果您的实际需求是动态获取 webapp 上下文,请尝试一下:
<c:import url="${pageContext.request.contextPath}/modules/some_module/SOME_CUSTOMER_ID/bill" />
关于java - 使用c :import to load Spring MVC View into div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15028379/