How can i get checkbox values from struts2 checkbox in displaytag to action class

…衆ロ難τιáo~ 提交于 2019-12-01 13:08:20

If you add a String[] to your action named the same as your checkbox(s) and expose it via accessors (getters/setters) struts 2 should auto populate it.

This is how I would do it.

  1. instead of 'id' for all id columns, append a sequence number so that each id has a unique name, such as 'id1', 'id2' etc

  2. create a interceptor that collects values of parameters prefixed with 'id'

  3. configure your action to use the interceptor

My strut fu is rusty though. There probably is a better way.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!