Re: [问题] Spring MVC 跳脱 "," to array

楼主: k80097   2014-10-31 00:20:06
※ 引述《k80097 ()》之铭言:
: 大家好
: 想请问在spring mvc里
: Form summit input text
: 如何跳脱","符号而不会转换成 array 呢?
: 谢谢
controller:
@RequestMapping(value = "/test")
public String test(@ModelAttribute TestObject o){
}
public class TestObject {
private Test[] tests;
//getter tests
//setter tests
}
public class Test {
private String[] stringArray;
//getter stringArray
//setter stringArray
}
JSP:
<input type="text" name="tests[0].stringArray" />
输入值为: a,b,c
controller 接到就直接转array了
作者: ssccg (23)   2014-10-31 06:17:00
tests[0].stringArray[0] ?
作者: cyclone350 (老子我最神)   2014-10-31 09:13:00
楼上方法测试: 对Array无效,对List有效
作者: yyc1217 (somo)   2014-10-31 09:23:00
name直接用tests[]然后controller这边就String[] tests

Links booklink

Contact Us: admin [ a t ] ucptt.com