第一種,普通的方法:
想在JSF控件中操作框架頁Frameset,可以在左框架頁(任一框架頁)里聲明一個Form,設定好它的target="mainFrame"(任一框架頁的id),這樣當點擊這個Form里面的CommandButton或者CommandLink的時候,JSF處理好業務邏輯后,就可以將To-View-ID指定的頁面轉到主框架頁里面去顯示了。
<h:form target="mainFrame">
<h:commandButton action="index">
</h:form
|
mainFrame |
點擊左邊的commandButton之后,index處理之后的To-View-ID指定的頁面就會顯示在mainFrame里面了
第二種方法:

<script>

function forward(p)
{
window.parent.mainFrame.location.href="usermanagement/" + p + ".faces";
}
</script>
添加一個跳轉函數,然后分情況添加跳轉:
當不需要Action的時候
<rich:panelMenuItem label="角色信息維護" onclick="forward('rolelist')" />
這樣就可以跳轉了
當需要先進行Action操作再跳轉的時候
<rich:panelMenuItem label="新建角色"
action="#{user.addRoleMain}" oncomplete="forward('roledetail')" />
public String addRoleMain()

{
ClearRole();
return null;
}
這樣,在Action完成后,菜單頁不會變,主框架頁會跳轉到指定頁面。
OK,上面兩種方法基本能滿足開發需要了。
---------------------------------------------------------
專注移動開發
Android, Windows Mobile, iPhone, J2ME, BlackBerry, Symbian
posted on 2008-11-08 01:05
TiGERTiAN 閱讀(2410)
評論(1) 編輯 收藏 所屬分類:
Java 、
JSF