NutzCN Logo
问答 前台参数到后台封装转报转换异常,是否是新bug
发布于 2078天前 作者 qq_710cab78 1440 次浏览 复制 上一个帖子 下一个帖子
标签:

前台jsp界面:  如果只选中一个就会报异常,选中两个或两个以上就不会报异常




合同名称







合同签订日期


后台代码:
@At
@Ok("jsp:/template/workflow/CompleteWorkItemOk.jsp")
@Fail("jsp:/template/include/_error.jsp")
@AdaptBy(type = UploadAdaptor.class, args = { "ioc:myUpload" })
public Map<String, Object> addChange(
@Param("..")final ContractChange obj,
@Param("updateField")final List updateField,  -- 这里会出现转换异常
final Map allParam){

[2019-03-08 14:10:01][WARN] [org.nutz.mvc.impl.processor.FailProcessor:28] - Error@/module/ContractChange/addChange :
org.nutz.castor.FailToCastObjectException: Fail to cast from <java.lang.String> to <java.util.List> for {name}
	at org.nutz.castor.Castors.cast(Castors.java:263)
	at org.nutz.castor.Castors.castTo(Castors.java:317)
	at org.nutz.mvc.adaptor.injector.NameInjector.get(NameInjector.java:93)
	at org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:294)
	at org.nutz.mvc.upload.UploadAdaptor.adapt(UploadAdaptor.java:120)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:30)
	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:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at com.okideaad.erp.security.MenuUrlFilter.doFilter(MenuUrlFilter.java:66)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at com.okideaad.erp.security.MustChangePwdFilter.doFilter(MustChangePwdFilter.java:31)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at com.okideaad.erp.security.EmailSSOFilter.doFilter(EmailSSOFilter.java:61)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at com.okideaad.erp.security.QQLoginFilter.doFilter(QQLoginFilter.java:44)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.okideaad.erp.filter.EncodingFilter.doFilter(EncodingFilter.java:34)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:662)
Caused by: org.nutz.json.JsonException: !Json syntax error nearby [row:1,col:1 char 'n'], reason: 'Unexpect String = name'
	at org.nutz.json.impl.JsonTokenScan.readObject(JsonCompileImplV2.java:304)
	at org.nutz.json.impl.JsonTokenScan.read(JsonCompileImplV2.java:360)
	at org.nutz.json.impl.JsonCompileImplV2.parse(JsonCompileImplV2.java:27)
	at org.nutz.json.Json.fromJson(Json.java:57)
	at org.nutz.json.Json.parse(Json.java:92)
	at org.nutz.json.Json.fromJson(Json.java:73)
	at org.nutz.castor.castor.String2Collection.cast(String2Collection.java:16)
	at org.nutz.castor.castor.String2Collection.cast(String2Collection.java:10)
	at org.nutz.castor.Castors.cast(Castors.java:253)
	... 54 more
5 回复

前台的发现html不见了,现在下面补

<tr align="left">
						<td>
							<label>
								<input type="checkbox" name="updateField" value="name" description="合同名称">
								合同名称
							</label>
						</td>
					</tr>
					<tr align="left">
						<td>
							<label>
								<input type="checkbox" name="updateField" value="signTime" description="合同签订日期">
								合同签订日期
							</label>
						</td>
					</tr>

用 插入代码/日志片段 按钮

updateField应该用字符串或数组来接

为了不改底层代码,我临时加一个

<input type="hidden" name="updateField" value="test123456">
添加回复
请先登陆
回到顶部