Home  >  Q&A  >  body text

java - SSH中Action中如何接收jsp提交的二维参数?

比如说我有以下数据需要传输到Action页面
在A页面通过form表单的post提交数据到Action

goods[0][code]=3
goods[0][name]=fds
goods[0][price]=1000
goods[1][code]=3
goods[1][name]=fdsfd
goods[1][price]=2000

那么现在的问题是在Action如何才能获取这一系列的数值?

伊谢尔伦伊谢尔伦2720 days ago394

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-18 09:05:11

    Use composite objects to map

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 09:05:11

    Submit the form content into a JSON string on the client, such as:

    {
      goods: [
        good: {
          code: 3,
          name: 'fds',
          price: 1000
        },
        ...
      ]
    }

    Use Jackson or GSON on the server side to restore the JSON string to an object.

    reply
    0
  • Cancelreply