[jboss-user] [JBoss Seam] - @DataModelSelection Is Update When @Factory Method Gets Call
elvisisking
do-not-reply at jboss.com
Fri Jan 11 17:37:19 EST 2008
I'm writing a very simple Web application and trying to use POJOs instead of SBs. I have a page that displays a parent object and it's children. The children's names are displayed in the cells of a datatable. Each child has an associated SEAM link that is used to redisplay the current page but now using the child as the parent. When I click the child link the page does redisplay but since the @DataModelSelection value is always set to the first child in the collection the wrong child is displayed (unless I click on the first child:-). I've verified that the @DataModelSelection is only updated when the @Factory method is called. See code (modified for simplicity) below. Thanks much for your help.
xhtml code:
<rich:dataTable
value="#{pojo.kids}"
var="child">
<rich:column>
<f:facet name="header">
<h:outputText
styleClass="tableHeaderText"
value="Child Name" />
</f:facet>
<s:link
action="#{pojo.viewChild}"
value="#{child.name}">
</s:link>
</rich:column>
</rich:dataTable>
pojo code:
@Name( "pojo" )
@Scope( ScopeType.SESSION )
public class Pojo implements Serializable {
@Out
@DataModelSelection( "kids" )
private Node child;
private Node node;
@DataModel
private List kids;
@Factory( "kids" )
public List getNodeChildren() throws Exception {
this.kids = this.node.getChildren();
return this.kids;
}
public String viewChild() throws Exception {
this.node = this.child;
return "view";
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119267#4119267
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119267
More information about the jboss-user
mailing list