[jboss-user] [JBoss Seam] - DataModelSelection is null

ilya78 do-not-reply at jboss.com
Tue Aug 7 12:29:56 EDT 2007


I have a page that should display a list of most recent events ocured. By clicking on each event some information should be displayed about the event.

I am using a DataModel to display the list, but the problem is that after clicking an item, the DataModelSelection is null.

I have made a simplified example, in order to show the problem:


  | @Name("eventComponent")
  | @Scope(ScopeType.EVENT)
  | public class MyLatestAction {
  | 	
  |     @In FacesMessages facesMessages;
  |     
  |     @DataModel(value="eventList")
  |     private List<Integer> eventList;
  |     
  |     @DataModelSelection
  |     private Integer selectedEvent;
  |     
  |     @Factory("eventList")
  |     public void initRequestList() {
  |     	eventList = new ArrayList<Integer>();
  |     	eventList.add(1);
  |     	eventList.add(2);
  |     	eventList.add(3);
  |     }
  |     public void selectEvent() {
  |         facesMessages.add("selected event: "+selectedEvent);
  |     }
  |     
  | }
  | 

the view eventList.xhtml contains this code:

  | ...
  |     <h:messages globalOnly="true" styleClass="message"/>
  | 
  | 	<h:dataTable value="#{eventList}" var="item" >
  | 			<h:column>
  | 				<f:facet name="header">Event</f:facet>
  | 				<s:link action="#{eventComponent.selectEvent}" value="#{item}"/>
  | 			</h:column>
  | 	</h:dataTable> 
  | 
  | ...
  | 


I am accessing the page from the menu with a link like this:

  |          <s:link view="/eventList.xhtml" value="Event List"/>
  | 

The problem is that even though the page correctly displays  the list of events (1, 2, 3), when I select an event, in the bean the selection is null (it prints "selcted event: null"

What am I doing wrong

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071696#4071696

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071696



More information about the jboss-user mailing list