How can I get values out of a selectOneMenu inside a JSF datatable?

依然范特西╮ 提交于 2019-12-01 19:53:46

I see your table has binding to your bean. In your bean you can use the getDataTable() method and access it. Java doc says:

public Object getRowData()

Return the data object representing the data for the currently selected row index, if any.

So if you do your code like:

List<String> selectedRowData = (List<String>) getDataTable().getRowData()

You can then access all the fields the user has chosen. Im using this in my own project and its working. The only difference is that Im casting to my own type instead of List<String>

There are no obvious errors in the form - if your save method is not being invoked, try adding a messages tag to your form to help track down the source of the problem. It would help if you posted a sample bean that reproduces the problem and state the JSF implementation and version you are using.

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