[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1161) s:link breaks @DataModelSelection functionallity, when having a page action

Daniel Wiell (JIRA) jira-events at lists.jboss.org
Tue Apr 10 12:08:14 EDT 2007

s:link breaks @DataModelSelection functionallity, when having a page action

                 Key: JBSEAM-1161
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1161
             Project: JBoss Seam
          Issue Type: Bug
    Affects Versions: 1.2.1.GA
         Environment: Seam 1.2.1.GA, MyFaces 1.1.6 nighly from march, Facelets 1.1.11
            Reporter: Daniel Wiell

If a s:link is used to select a row in a dataTable. A field annotated with @DataModelSelection always get the first row of the dataModel **if** the view has a page action. When the page action is removed or a regular h:commandLink is used, everything works as expected.

Here are some code to help reproducing this:
------------------------ The controller
public class FruitStore {
    public static final List<Fruit> FRUITS = Arrays.asList(
            new Fruit(1, "Apple", "Red"),
            new Fruit(2, "Pear", "Green"),
            new Fruit(3, "Orange", "Orange"),
            new Fruit(4, "Banana", "Yellow"));

    @DataModel(scope = ScopeType.PAGE)
    private List<Fruit> fruits = FRUITS;
    private Fruit selectedFruit;

    public Fruit getSelectedFruit() { return selectedFruit; }

    public String init() { return null; }

------------------------ The domain object
public class Fruit {
    private long id;
    private String name;
    private String color;

    public Fruit(long id, String name, String color) {
        this.id = id;
        this.name = name;
        this.color = color;

    public long getId() { return id; }
    public void setId(long id) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getColor() { return color; }
    public void setColor(String color) { this.color = color; }

------------------------ Relavant parts from pages.xml
    <page view-id="/fruitSelection.xhtml" action="#{fruitStore.init}">
            <rule if-outcome="selectFruit">
                <redirect view-id="/fruitOverview.xhtml">
                    <param name="fruitId" value="#{fruitStore.selectedFruit.id}"/>

------------------------ fruitSelection.xhtml
<?xml version='1.0' encoding='UTF-8'?>
<html xmlns="http://www.w3.org/1999/xhtml"
    Select a fruit: 
    <h:dataTable var="fruit" value="#{fruits}">
            <!-- The page action (action="#{fruitStore.init}") breaks the @DataModelSelection
                 functionallity. It always get the first row.
                 When removing the page action everything works -->
            <s:link value="#{fruit.name}" action="selectFruit"/>
            <!-- This works -->
            <h:commandLink value="#{fruit.name}" action="selectFruit"/>

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list