struts2树结构加超级链接

1 使用tree  treenode标签生成静态树形
 
            <%@ taglib uri="/struts-tags" prefix="s"%>
 
            <s:head theme="ajax" debug="true" />
 
            <div style="float:left; ">
                       
              <s:tree label="parent" id="parentId" theme="ajax" 
                  showRootGrid="true"
                  showGrid="true">
                  
                  <s:treenode theme="ajax" label="child1" id="child1Id">
                      <s:treenode theme="ajax" label="gChild1" id="gChild1Id" />
                      <s:treenode theme="ajax" label="gChild2" id="gChild2Id" />
 
                  </s:treenode>
                  <s:treenode theme="ajax" label="child2" id="child2Id" />
                  <s:treenode theme="ajax" label="child3" id="child3Id" />
                  <s:treenode theme="ajax" label="child4" id="child4Id" />
                  <s:treenode theme="ajax" label="child5" id="child5Id">
                      <s:treenode theme="ajax" label="gChild1" id="gChild1Id" />
                      <s:treenode theme="ajax" label="gChild2" id="gChild2Id" />
                  </s:treenode>
              </s:tree>
          </div>
 
 
 
2 添加超链接
 
 
 
<s:treenode theme="ajax" label= "<a href='xxx.jsp' >gChild1</a>"  id="gChild1Id" />
 
 
 
 
 
3想实现<s:a>的ajax效果,添加脚本 
 
 
 
 
 
            <%@ taglib uri="/struts-tags" prefix="s"%>
 
            <s:head theme="ajax" debug="true" />
 
 
 
        <script type="text/javascript">

       dojo.event.topic.subscribe("treeSelected", function treeNodeSelected(node) {
          //alert(node.source.widgetId);
          dojo.io.bind({
              url: "<s:url value='"+node.source.widgetId+"'/>",
              load: function(type, data, evt) {
                  var mainContent = dojo.byId("mainContent");
                  mainContent.innerHTML=data;
              },
              mimeType: "text/html"
          });
      });
 
 
 
            
        </script> 
 
 
 
 
 
 
 
            <div style="float:left; ">
                       
              <s:tree label="parent" id="parentId" theme="ajax" 
                  showRootGrid="true"
                  showGrid="true">
                  
                  <s:treenode theme="ajax" label="child1" id="xxx.jsp">
                      <s:treenode theme="ajax" label="gChild1" id="xxx.jsp" />
                      <s:treenode theme="ajax" label="gChild2" id="xxx.jsp" />
 
                  </s:treenode>
                  <s:treenode theme="ajax" label="child2" id="child2Id" />
                  <s:treenode theme="ajax" label="child3" id="child3Id" />
                  <s:treenode theme="ajax" label="child4" id="child4Id" />
                  <s:treenode theme="ajax" label="child5" id="child5Id">
                      <s:treenode theme="ajax" label="gChild1" id="xxx.jsp" />
                      <s:treenode theme="ajax" label="gChild2" id="xxx.jsp" />
                  </s:treenode>
              </s:tree>
          </div>
 
 
 
  <div id="container">
 
  </div>
 
 
 
在treenode中id设置要超链接的页面,在<script>获取id得到要超链接的页面,用dojo实现ajax效果
 
 
 
 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值