jsf中怎样动态改变include的src地址

我想根据一个bean里的url,动态改变include中的src,试了几次都不行。
java 代码
 
  1. <body style="margin:0;" bgcolor="#f4f4ea">  
  2.   
  3. <f:view>  
  4. <h:form id="form">  
  5.         <div >  
  6.         <e:include id="moduleTree" src="system/module_tree.jsp"/>  
  7.       </div>  
  8.       
  9.       
  10.       <div >  
  11.         <e:include id="mainPane" src="#{controlBean.mainPanePath}"/>  
  12.       </div>  
  13.      
  14. </h:form>  
  15. </f:view>  
java 代码
 
  1. public class ControlBean {  
  2.     private String mainPanePath="org_manager/context.jsp";  
  3.   
  4.     /** 
  5.      * @return the mainPanePath 
  6.      */  
  7.     public String getMainPanePath() {  
  8.         return mainPanePath;  
  9.     }  
  10.   
  11.     /** 
  12.      * @param mainPanePath the mainPanePath to set 
  13.      */  
  14.     public void setMainPanePath(String mainPanePath) {  
  15.           
  16.         this.mainPanePath = mainPanePath;  
  17.     }  
  18.     public void setPath(ActionEvent event) {  
  19.   
  20.         Module cell = ((Module) ((Tree) event.getSource()).getSelection());  
  21.         if (cell.getUrl() != null && cell.getUrl().trim().length() > 0) {  
  22.             this.setMainPanePath(cell.getUrl());  
  23.               
  24.         }  
  25.     }  
  26. }  
tree
java 代码
 
  1. <e:tree id="tree-basic" model="#{moduleTreeModelBean.treeModel}"   
  2.             rootExpanded="false"  
  3.             onselection="#{controlBean.setPath}"  
  4.             cellStyle="normalTreeCell"  
  5.             hoverStyle="blueTreeCell"  
  6.             selectedStyle="whiteTreeCell" preloadDepth="1">  
  7.   
  8.        
  9.         <e:treecell value="#{NODE.name}"  
  10.                     styleClass="treeCellBold"  
  11.                     icon="#{NODE.leaf?'/images/draft.jpg':'/images/trash.jpg'}"/>  
  12.           
  13.     </e:tree>  
树上点击链接,改变另一个include的url
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值