jus*_*ris 5 java spring freemarker
我有SpringMVC项目,Freemarker作为视图解析器.在一些模板中,我必须生成包括主机名在内的链接,但我无法得到它.在JSP中,我可能会这样做:
`<% String hostName=request.getServerName();%>`
Run Code Online (Sandbox Code Playgroud)
我试图使用" requestContextAttribute",但requestContext.getContextPath()返回没有主机名的路径.我在哪里可以单独获得完整路径或主机名?
我们可以在 JSTL 中做到这一点。尝试在 FreeMarker 中进行调整:
${pageContext.request.serverName}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5881 次 |
| 最近记录: |