我想根据一个bean里的url,动态改变include中的src,试了几次都不行。
tree
树上点击链接,改变另一个include的url
java 代码
- <body style="margin:0;" bgcolor="#f4f4ea">
- <f:view>
- <h:form id="form">
- <div >
- <e:include id="moduleTree" src="system/module_tree.jsp"/>
- </div>
- <div >
- <e:include id="mainPane" src="#{controlBean.mainPanePath}"/>
- </div>
- </h:form>
- </f:view>
java 代码
- public class ControlBean {
- private String mainPanePath="org_manager/context.jsp";
- /**
- * @return the mainPanePath
- */
- public String getMainPanePath() {
- return mainPanePath;
- }
- /**
- * @param mainPanePath the mainPanePath to set
- */
- public void setMainPanePath(String mainPanePath) {
- this.mainPanePath = mainPanePath;
- }
- public void setPath(ActionEvent event) {
- Module cell = ((Module) ((Tree) event.getSource()).getSelection());
- if (cell.getUrl() != null && cell.getUrl().trim().length() > 0) {
- this.setMainPanePath(cell.getUrl());
- }
- }
- }
java 代码
- <e:tree id="tree-basic" model="#{moduleTreeModelBean.treeModel}"
- rootExpanded="false"
- onselection="#{controlBean.setPath}"
- cellStyle="normalTreeCell"
- hoverStyle="blueTreeCell"
- selectedStyle="whiteTreeCell" preloadDepth="1">
- <e:treecell value="#{NODE.name}"
- styleClass="treeCellBold"
- icon="#{NODE.leaf?'/images/draft.jpg':'/images/trash.jpg'}"/>
- </e:tree>