效果如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>添加区域</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<script type="text/javascript">
var data = new Array();
/**
data[0] = {id: '0',pid: '1',text: '河北'};
data[1] = {id: '1',pid: '-1',text: '中国'};
data[2] = {id: '2',pid: '6',text: '莫斯科'};
data[3] = {id: '3',pid: '0',text: '邯郸'};
**/
var i=0;
var temp;
<c:forEach items="${allRegions}" var="r">
<c:if test="${r.regionId gt 1}">
data[i] = { id: '${r.regionId}',pid: '${r.superiorRegion.regionId}'