本文介紹了使用 Ajax 進行 JSF 導航的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
例如,如果我放置以下組件并單擊它,它將按預期運行:
If I place, for instance, the following component and click it, it behaves as expected:
<h:commandLink value="Click me" action="anotherPage.jsf" />
但如果我使用 Ajax:
But if I use Ajax:
<h:commandLink value="Click me" action="anotherPage.jsf"><f:ajax /></h:commandLink>
它不會導航到其他頁面.我錯過了什么嗎?這不應該有效嗎?
It doesn't navigate to the other page. Am I missing something? Isn't this supposed to work?
另一個問題是,當我在會話超時后單擊使用 ajax 的按鈕時,應用程序會重定向到登錄頁面,但它不會加載 css 文件.
Another issue is that, when I click a button that is using ajax after session timeout, the application redirects to the login page but it doesn't load css files.
有什么想法嗎?
親切的問候,
卡洛斯·費雷拉
推薦答案
如果您發送重定向,您可以做到.
You can do it if you send a redirect.
action="anotherPage.jsf?faces-redirect=true"
但是,我完全看不到像這樣使用 Ajax 進行導航的意義/好處.
However, I completely fail to see the point/benefit of navigating using Ajax like that.
這篇關于使用 Ajax 進行 JSF 導航的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!