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

前端 未结 2 1990
半阙折子戏
半阙折子戏 2021-01-15 18:30

I am working on struts2 application in which i am using displaytag for pagination support.

Now i want a check box for each row in t

相关标签:
2条回答
  • 2021-01-15 18:54

    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.

    0 讨论(0)
  • 2021-01-15 18:57

    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.

    0 讨论(0)
提交回复
热议问题