阅读701 返回首页    go 阿里云 go 技术社区[云栖]


Struts中JSP到Action过程中数组的投射

Jsp

<div>

    <input type="hidden" name="stulst.name" value="xy"/>

    <input type="hidden" name="stulst.name" value="xy1"/>

    <input type="hidden" name="stulst.name" value="xy2"/>

</div>

这就表明,有三条不同的记录。


Action

public List<Student> stulst;

...................................................

public Stirng tosave()

{

    for(Student s : stulst)

    {

         name属性已经接收到了,就不要再设置了

          s.setAge(10);

          s.setPhone("111");

          stuService.save(s);

    }

    return "tosave";

}

 

以上是简单的情况,关于struts如何接受数组的详细文章,请参见我的

《struts中接收数组的表单和ajax两种形式》https://blog.csdn.net/woshixuye/article/details/7969496

 

 

最后更新:2017-04-02 22:16:21

  上一篇:go SQL常用函数及语句(不断更新)
  下一篇:go Hibernate联合主键