NutzCN Logo
问答 将数组数据组装成NutMap返回map抛出异常,另外问一下前端如何接受map子数组
发布于 2690天前 作者 qq_412bd180 1558 次浏览 复制 上一个帖子 下一个帖子
标签:

先上代码:

@At
	@Ok("re:jsp:jsp.admin.rader")
	public NutMap rader(String id){
		//存储时间段
		String[] dateTime=new String[10];
		//存储图像路径
		String[] images=new String[10];
		HttpRequest request = HttpRequest.get("http://products.weather.com.cn/product/radar/index/procode/JC_RADAR_"+id+"_JB");
		String htmlBody=request.body();
		//截取数据
		htmlBody = htmlBody.substring(htmlBody.indexOf("<select name=\"slide3\""), htmlBody.indexOf("</form>"));
		Document doc = Xmls.xml(Lang.ins(htmlBody));
		NodeList optionNode = doc.getElementsByTagName("option");
		NutMap map=new NutMap();
		for (int i = 0; i < 10; ++i) {
			//截取10个option节点
			Element element = ((Element) optionNode.item(optionNode.getLength()-10+i));
			images[i] = element.getAttribute("value").replaceFirst("/l/", "/m/");
			dateTime[i] = element.getTextContent().substring(11);
			map.addv("dateTime",dateTime[i]);
			map.addv("images",images[i]);
		}

		return map;

异常信息:

java.lang.RuntimeException: Can not eval {dateTime=[16时30分, 16时36分, 16时42分, 16时48分, 16时54分, 17时06分, 17时12分, 17时18分, 17时24分, 17时30分], images=[http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712083000000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l...
16 回复

页面代码也贴上

<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<t:adminpage page="rader" pageTitle="testRader" pageDesc=".">
	<jsp:attribute name="resources">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/fancytree/skin-bootstrap/ui.fancytree.min.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/select2/select2.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/ion.rangeSlider/ion.rangeSlider.skinModern.css" />
		<!-- <link rel="stylesheet" href="${pageContext.request.contextPath}/css/vueCRUD.css"> -->
		<style type="text/css">
			span{
				font-size: 12px
			}
		</style>
    </jsp:attribute>
	<jsp:attribute name="bottomScripts">
		<script type="text/javascript">
			
		</script>
   	</jsp:attribute>
   	
   	<jsp:attribute name="bottomScripts">
   	<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/fancytree/jquery.fancytree-all.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/bootstrap-notify/bootstrap-notify.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/select2/select2.full.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/bootstrap-tagsinput/bootstrap-tagsinput.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/vue/vue.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/ion.rangeSlider/ion.rangeSlider.min.js"></script>
	<script>
		$(document).ready(function() {
			
		});	
	</script>
	
	</jsp:attribute>
	
	<jsp:body>
	
		<div class="row" id="app">
			<div class="col-md-12">
				<div class="box box-success">
					<div class="box-header with-border">
	              		<h3 class="box-title">雷达图像</h3>
	            	</div>
	            	<div class="box-body no-padding">
	                	<!-- box body -->
	                	<div id="rader">
	                		<div class="col-md-12">
	                			<!-- var nodes = <c:out value="${nodesJson}"  escapeXml="false"/>; -->
								<%-- <c:forEach items="${obj}" var="item" varStatus="vs">
									<span>${item }</span>
								</c:forEach> --%>
							</div>
	                	</div>
	                	<!-- box body -->
	            	</div>
				</div>
			</div>
		</div>
	
	</jsp:body>

</t:adminpage>

详细报错日志, 怎么觉得是入口方法内报错了呢

2017-07-12 17:54:39 [http-nio-8080-exec-126] WARN  org.nutz.mvc.impl.processor.FailProcessor - Error@/rader/rader :
java.lang.RuntimeException: Can not eval {dateTime=[16时36分, 16时42分, 16时48分, 16时54分, 17时06分, 17时12分, 17时18分, 17时24分, 17时30分, 17时36分], images=[http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712083600000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712084200000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712084800000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712085400000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712090600000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712091200000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712091800000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712092400000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712093000000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712093600000.png]}("{dateTime=[16时36分, 16时42分, 16时48分, 16时54分, 17时06分, 17时12分, 17时18分, 17时24分, 17时30分, 17时36分], images=[http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712083600000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712084200000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712084800000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712085400000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712090600000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712091200000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712091800000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712092400000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712093000000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712093600000.png]}") View for public org.nutz.lang.util.NutMap io.longview.iib.admin.module.RaderModule.rader(java.lang.String)
	at org.nutz.lang.Lang.makeThrow(Lang.java:132)
	at org.nutz.mvc.view.ViewZone.makeView(ViewZone.java:90)
	at org.nutz.mvc.view.ViewZone.render(ViewZone.java:47)
	at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:60)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)

页面显示这个信息

{"dateTime":["16时42分", "16时48分", "16时54分", "17时06分", "17时12分", "17时18分", "17时24分", "17时30分", "17时36分", "17时42分"],"images":["http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712084200000.png", "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712084800000.png", "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712085400000.png", "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712090600000.png", "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712091200000.png", "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712091800000.png", "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712092400000.png", "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712093000000.png", "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712093600000.png", "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712094200000.png"]}

用的ViewZone的话, 返回值只能是String的

@Ok("re:jsp:jsp.admin.rader")

你要返回对象到页面的话, 加上ViewModel参数

你这个也是咋来的??

        @At
	@Ok("jsp:jsp.admin.rader")
	public NutMap rader(String id){

改了以后还是报错:

package io.longview.iib.admin.module;

import java.util.ArrayList;
import java.util.List;

import org.nutz.ioc.annotation.InjectName;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.Xmls;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.Mvcs;
import org.nutz.mvc.ViewModel;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import com.github.kevinsawicki.http.HttpRequest;

@At("/rader")
@InjectName
@IocBean
public class RaderModule {

	private static final Log log = Logs.get();
	
	@At
	@Ok("re:jsp:jsp.admin.testBasic")
	public void test() {
		
	}
	
	@At
	@Ok("re:jsp:jsp.admin.rader")
	public NutMap rader(String id,ViewModel model){
		//存储时间段
		String[] dateTime=new String[10];
		//存储图像路径
		String[] images=new String[10];
		HttpRequest request = HttpRequest.get("http://products.weather.com.cn/product/radar/index/procode/JC_RADAR_"+id+"_JB");
		String htmlBody=request.body();
		//截取数据
		htmlBody = htmlBody.substring(htmlBody.indexOf("<select name=\"slide3\""), htmlBody.indexOf("</form>"));
		Document doc = Xmls.xml(Lang.ins(htmlBody));
		NodeList optionNode = doc.getElementsByTagName("option");
		NutMap map=new NutMap();
		for (int i = 0; i < 10; ++i) {
			//截取10个option节点
			Element element = ((Element) optionNode.item(optionNode.getLength()-10+i));
			images[i] = element.getAttribute("value").replaceFirst("/l/", "/m/");
			dateTime[i] = element.getTextContent().substring(11);
			model.setv("dateTime",dateTime[i]);
			model.setv("images",images[i]);
		}

		return model;
		
	}
}

java.lang.RuntimeException: Can not eval {
   "dateTime": "17时54分",
   "images": "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712095400000.png"
}("{
   "dateTime": "17时54分",
   "images": "http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170712095400000.png"
}") View for public org.nutz.lang.util.NutMap io.longview.iib.admin.module.RaderModule.rader(java.lang.String,org.nutz.mvc.ViewModel)
	at org.nutz.lang.Lang.makeThrow(Lang.java:132)
	at org.nutz.mvc.view.ViewZone.makeView(ViewZone.java:90)
	at org.nutz.mvc.view.ViewZone.render(ViewZone.java:47)
	at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:60)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)

@Ok改成我写的值

搞定 谢谢前辈! 我能问一下原理吗?

@Ok("re:XXXXXX") 方法的返回值必须是String,你写成NutMap就不能这样用咯

前端代码:

<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<t:adminpage page="rader" pageTitle="testRader" pageDesc=".">
	<jsp:attribute name="resources">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/fancytree/skin-bootstrap/ui.fancytree.min.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/select2/select2.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/ion.rangeSlider/ion.rangeSlider.skinModern.css" />
		<!-- <link rel="stylesheet" href="${pageContext.request.contextPath}/css/vueCRUD.css"> -->
		<style type="text/css">
			span{
				font-size: 12px
			}
			
			.raderImage{
				margin: auto;
			}
		</style>
    </jsp:attribute>
	<jsp:attribute name="bottomScripts">
		<script type="text/javascript">
			
		</script>
   	</jsp:attribute>
   	
   	<jsp:attribute name="bottomScripts">
   	<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/fancytree/jquery.fancytree-all.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/bootstrap-notify/bootstrap-notify.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/select2/select2.full.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/bootstrap-tagsinput/bootstrap-tagsinput.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/vue/vue.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/plugins/ion.rangeSlider/ion.rangeSlider.min.js"></script>
	<script>
		$(document).ready(function() {
			var dataTime='${obj.dateTime}';
			var images='${obj.images}';
			
			init();
			
			function init(){
				//$(".raderImage").attr("src", images[images.length-1]);
				console.log("images:"+images);
				console.log("images[0]:"+images[0])
			}
		});	
	</script>
	
	</jsp:attribute>
	
	<jsp:body>
	
		<div class="row" id="app">
			<div class="col-md-12">
				<div class="box box-success">
					<div class="box-header with-border">
	              		<h3 class="box-title">雷达图像</h3>
	            	</div>
	            	<div class="box-body no-padding">
	                	<!-- box body -->
	                	<div id="rader">
	                		<div class="col-md-12">
	                			<!-- 雷达图像 -->
	                			<div>
	                				<img class="raderImage" src=""/>
	                			</div>
	                			<!-- var nodes = <c:out value="${nodesJson}"  escapeXml="false"/>; -->
								<c:forEach items="${obj.dateTime}" var="item" varStatus="vs">
									<span>${item }</span>
								</c:forEach>
							</div>
	                	</div>
	                	<!-- box body -->
	            	</div>
				</div>
			</div>
		</div>
	
	</jsp:body>

</t:adminpage>

var dataTime='${obj.dateTime}'; 返回的是

images:[http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713021800000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713022400000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713023000000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713023600000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713024800000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713025400000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713030000000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713030600000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713031200000.png, http://pi.weather.com.cn/i/product/pic/m/sevp_aoc_rdcp_sldas_ebref_az9010_l88_pi_20170713031800000.png]

console.log("images[0]:"+images[0]) 输出是:

images[0]:[

返回的是像数组的字符串啊。。
如何转换成数组呢?

obj就是方法返回值

添加回复
请先登陆
回到顶部