![](/img/trans.png)
[英]Get path from a JSP with Apache Tiles 3 and Spring MVC 3.2.3
[英]How to get url path from jsp in Spring MVC framework
從頁面視圖中刪除語言切換(確認頁面)
我找到了這段代碼,但它在 Spring MVC 中不起作用
<c:if test="${!fn:contains(pageContext.request.servletPath,'/comfirmation')}">
//Other Code
</c:if>
最后我得到了它。 這里我們 go
<%
String url=request.getAttribute("javax.servlet.forward.servlet_path").toString();
if(url.equals("/Confirmation.htm")){
%>
//Language Toggle code
<% } %>
我決定用這個。 另一種方法是將 url 路徑存儲在 session 中,因為前面是 controller。
pageContext.request.servletPath
將為您提供 jsp 的路徑(而不是瀏覽器顯示的 url)。
請求被轉發到 controller,它返回視圖的路徑。 使用第二個內部請求調用視圖
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.