开发者

Unable to view detail of an Object, if rendered via a @Factory method

I have the following code in my entity query class, which I u开发者_JAVA技巧se to display a List objects. The objects do get displayed properly when I use the @Factory method name ("users") to iterate through all members in a rich:dataTable. But when I click on particular user to go the detail page, the following gets tacked on as a page parameter (e.g. &dataModelSelection=_user:users[0])which causes the page to not show the detail information, but if I remove this query parameter it seems to work fine. What could be possibly going wrong here?

@Name("userList")
public class UserList extends EntityQuery<User> {

    @DataModel(scope = ScopeType.PAGE)
    private List<User> users;

    @Factory("users")
    public List<User> getUsersByOrg() {

}

Note: If I comment out the line containing the @DataModel annotation, the above defined parameter is not defined and I am able to view user details.


@DataModel annotation allows Seam to wrap some java.util.* collections such as List, Set and so on... JSF UIData components (rich:dataTable, for instance) needs a special collection wrapper whose base class is javax.faces.DataModel. It supports row selection made by user It explains why you see

dataModelSelection=_user:users[0]

So if you want to capture the selected user, you should use @DataModelSelection

@DataModelSelection
@Out(required=false)
private User selectedUser;

You can use h:commandLink to throw the backed action

<rich:datTable value="#{users}" var="_user">
    <h:column>
        <f:facet name="header">Action</f:facet>
        <h:commandLink action="#{userHome.view}" value="View"/>
    </h:column>
</richTable>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜