网站首页 新闻首页 网页设计图形动画软件编程网站开发办公软件操作系统数据库网络技术认证考试范文资料黑客攻防 书籍教程 进入论坛

Nested嵌套迭代

http://www.diybl.com/ 2008-2-22  网络 点击:  [ 评论 ]
文章搜索:    【点击打包该文章】

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %>
<%
HashMap map=new HashMap();
ArrayList dogs=new ArrayList();
dogs.add("dog1");
dogs.add("dog2");
dogs.add("dog3");
ArrayList cats=new ArrayList();
cats.add("cat1");
cats.add("cat1");
cats.add("cat1");
map.put("dogs",dogs);
map.put("cats",cats);
request.setAttribute("map",map);
%>
<html:html lang="true">
  <head>
    <html:base />
    <title>nested嵌套迭代</title>
  </head>
  <body>
    <nested:iterate id="item" name="map">
      <ul>
        <nested:write name="item" property="key"/>
        <nested:iterate id="animals" name="item" property="value">
          <li><nested:write name="animals"/></li>
        </nested:iterate>
      </ul>
    </nested:iterate>
  </body>
</html:html> 

欢迎光临DIY部落,点击这里查看更多文章教程   【点击打包该文章】
如果图片或页面不能正常显示请点击这里 站内搜索:   

文章评论

请您留言