Java學習

          java,spring,structs,hibernate,jsf,ireport,jfreechart,jasperreport,tomcat,jboss -----本博客已經搬家了,新的地址是 http://www.javaly.cn 如果有對文章有任何疑問或者有任何不懂的地方,歡迎到www.javaly.cn (Java樂園)指出,我會盡力幫助解決。一起進步

           

          如何從java代碼中重定向一個JSF頁面

          如何從java代碼中重定向一個JSF頁面
          2006-09-10 14:53

          如何從java代碼中重定向一個JSF頁面

          1 示例代碼如下:
          public static void redirectPage(String szPage)
          {
           FacesContext context = FacesContext.getCurrentInstance();
           javax.faces.application.Application app = context.getApplication();
           UIViewRoot view = app.getViewHandler().createView(context, szPage);
           context.setViewRoot(view);
           context.renderResponse();
          }

           



          2. FacesContext fc = FacesContext.getCurrentInstance(); try {
          fc.getExternalContext().redirect(this.getRequest().getContextPath()+"/login.faces"); }
          catch (IOException e) { e.printStackTrace(); }

           


          The context line should have been declared before the application line of code

          FacesContext context = FacesContext.getCurrentInstance(); javax.faces.application.Application app = context.getApplication();

          posted on 2009-03-17 12:40 找個美女做老婆 閱讀(2374) 評論(1)  編輯  收藏

          評論

          # re: 如何從java代碼中重定向一個JSF頁面 2009-06-02 09:58 找個美女做老婆

          www.javaly.cn  回復  更多評論   


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          導航

          統計

          公告

          本blog已經搬到新家了, 新家:www.javaly.cn
           http://www.javaly.cn

          常用鏈接

          留言簿(6)

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 如东县| 天峻县| 乐亭县| 泌阳县| 沾化县| 普定县| 长乐市| 梧州市| 喀什市| 棋牌| 河南省| 九龙县| 中西区| 浦东新区| 汝南县| 宁远县| 博白县| 沅陵县| 宜黄县| 永济市| 龙川县| 山东省| 松阳县| 东港市| 中西区| 湘乡市| 双城市| 买车| 台湾省| 邹城市| 逊克县| 海晏县| 池州市| 涟源市| 平泉县| 蚌埠市| 齐河县| 新丰县| 玛曲县| 莫力| 凌海市|