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
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to