spring mvc 接收数据 数组+pojo

Controller
@RequestMapping("ask")
@ResponseBody
public RobotResponse get(RobotRequest robotRequest){

RobotRequest.java
public class RobotRequest implements java.io.Serializable {
private cn.eastrobot.www.ws.RobotServiceEx.UserAttribute[] attributes;

UserAttribute.java
public class UserAttribute implements java.io.Serializable {
private java.lang.String name;
private java.lang.String value;

问:前台如何传值可以封装到 robotRequest中
需要前台传值,经数据封装到 robotRequest的attributes中

笔者没有办法

阅读 2.2k
1 个回答

笔者已经找办法
localhost:8080/ask?question=你好&userId=litong&attributes[0].name=platform&attributes[0].value=weixin
不需要使用双引号将 值 引起来

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进