NutzCN Logo
问答 List数据如何接收
发布于 2551天前 作者 qq_117e429a 2641 次浏览 复制 上一个帖子 下一个帖子
标签:
	@At
	public Object SubmitUpdateMenu(@Param("updateMenu")List<JSONObject> list) {
		
		
		return CommunicationUtil.CastJsonFormat(true, "修改成功");
	}

List数据如何接收

9 回复

取决于发过来的数据是怎样的

前台传的数据格式是这样的

[{name:"admin",pwd:"123"},{name:"admin",pwd:"123"},{name:"admin",pwd:"123"}]
@Param("..")List<User> users

不是实体类的怎么接收

@Param("..")List<NutMap> maps

错误提示

2017-11-28 19:52:34,344 org.nutz.mvc.impl.NutActionChainMaker.eval(NutActionChainMaker.java:51) DEBUG - Eval FAIL!! : public java.lang.Object net.yubo.mobile.module.jurisdiction.JurisdictionModule.SubmitUpdateMenu(java.util.List)
org.nutz.lang.born.BorningException: Fail to born or cast to 'java.util.List'
 by args: []
 because: No suitable Constructor or Factory Method!!
	at org.nutz.lang.Mirror.getBorning(Mirror.java:954)
	at org.nutz.mvc.adaptor.injector.ObjectPairInjector.<init>(ObjectPairInjector.java:39)
	at org.nutz.mvc.adaptor.PairAdaptor.evalInjectorBy(PairAdaptor.java:54)
	at org.nutz.mvc.adaptor.AbstractAdaptor.evalInjector(AbstractAdaptor.java:190)
	at org.nutz.mvc.adaptor.AbstractAdaptor.init(AbstractAdaptor.java:129)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.evalHttpAdaptor(AdaptorProcessor.java:40)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.init(AdaptorProcessor.java:23)
	at org.nutz.mvc.impl.NutActionChainMaker.eval(NutActionChainMaker.java:38)
	at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:54)
	at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:201)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:108)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at net.yubo.mobile.mvc.NutzNutFilter.init(NutzNutFilter.java:25)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4700)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5340)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
2017-11-28 19:52:34,351 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:125) ERROR - Error happend during start serivce!
org.nutz.lang.born.BorningException: Fail to born or cast to 'java.util.List'
 by args: []
 because: No suitable Constructor or Factory Method!!
	at org.nutz.lang.Mirror.getBorning(Mirror.java:954)
	at org.nutz.mvc.adaptor.injector.ObjectPairInjector.<init>(ObjectPairInjector.java:39)
	at org.nutz.mvc.adaptor.PairAdaptor.evalInjectorBy(PairAdaptor.java:54)
	at org.nutz.mvc.adaptor.AbstractAdaptor.evalInjector(AbstractAdaptor.java:190)
	at org.nutz.mvc.adaptor.AbstractAdaptor.init(AbstractAdaptor.java:129)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.evalHttpAdaptor(AdaptorProcessor.java:40)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.init(AdaptorProcessor.java:23)
	at org.nutz.mvc.impl.NutActionChainMaker.eval(NutActionChainMaker.java:38)
	at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:54)
	at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:201)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:108)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
	at net.yubo.mobile.mvc.NutzNutFilter.init(NutzNutFilter.java:25)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4700)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5340)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
2017-11-28 19:52:34,352 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:127) ERROR - try to depose ioc
2017-11-28 19:52:34,358 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:255) INFO  - org.nutz.ioc.impl.NutIoc@194488304 is closing. startup date [17-11-28 19:52:32.880]
2017-11-28 19:52:34,358 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:108) DEBUG - Depose object 'tmpFilePool' ...
2017-11-28 19:52:34,359 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:262) INFO  - org.nutz.ioc.impl.NutIoc@194488304 is deposed. startup date [17-11-28 19:52:32.880]

接口信息

@At
	public Object SubmitUpdateMenu(@Param("..")List<NutMap> updateMenu) {
		
		return CommunicationUtil.CastJsonFormat(true, "修改成功");
	}

js

function SubmitUpdateMenu(){
	$.ajax({
		url:base+"/jurisdiction/SubmitUpdateMenu",
		data:{"updateMenu":updateMenu},
		dataType:"json",
		type:"post",
		success:function(result){
			if(result.status){
				LayerAlert(result.tips)
			}
		}
	})
}

数据格式

[ {mid: "3444", gid: "1", mpw: 1}, {mid: "3535", gid: "1", mpw: 2},{mid: "3449", gid: "1", mpw: 1}]

原来你没看过文档的。。。 要加@AdpteBy(type=JsonAdapter.class)

文档在哪个目录下,有连接吗

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