[jboss-user] [JBoss Seam] - How to select item in DataTable populated with @Unwrap?

mteichmann do-not-reply at jboss.com
Mon Dec 17 05:34:11 EST 2007


I like to use the Seam Manager Component pattern in Seam 2.0.0.GA and provide a list using @Unwrap:


  | @Name("holidayRequestByApproverList")
  | 
  | public class HolidayRequestByApproverList {
  | 
  | 	@Unwrap
  | 	public List<HolidayRequest> getHolidayRequestByApproverList() {
  | 
  | 		...
  | 	        return myList;
  | 	}
  | }

In a datatable I display the list :

<rich:dataTable id="dtHolidayRequestList" var="holidayRequest"
  | 				value="#{holidayRequestByApproverList}"
  | 				rendered="#{not empty holidayRequestByApproverList}">
  | ...
  | <h:column>
  | 					<f:facet name="header">
  | 						<s:span styleClass="columnHeader">Nr</s:span>
  | 					</f:facet>
  |             		#{holidayRequest.id}
  |         		</h:column>			
  | <h:column>
  | 					<f:facet name="header">Action</f:facet>
  | 
  | 					<s:button value="Reject"
  | 						action="#{holidayApprovalAction.reject(holidayRequest)}">
  | 					</s:button>
  | 				</h:column>

But in my action I always get null instead of holidayRequest that I selected in datatable.

@Stateful
  | @Name("holidayApprovalAction")
  | @Scope(ScopeType.SESSION)
  | public class HolidayApprovalActionImpl implements HolidayApprovalAction {
  | 
  | 	private static final long serialVersionUID = 6068522266849679060L;
  | 
  | 
  | 	@PersistenceContext(type = PersistenceContextType.EXTENDED)
  | 	EntityManager entityManager;
  | 			
  | 	@Begin
  | 	public void reject(HolidayRequest hr) {
  | 		...
  | 		entityManager.persist(hr);
  | 	}
  | 	

I read chapter 30.1 of Seam Reference 2.0.0.GA several times and maybe some limitations occur when using JSF but I also tried using facelets and also got 'null' instead of my selected item. 

Also in chapter 30.1.1 it is told in a note that you cannot use objects as arguments therefore I also tried using holidayRequest.id as parameter but then I got 0 instead of the id of the selected item. 

I used DataModel and DataModelSelection before but then the displayed data in rich table was not refreshed correctly. Therefore I tried to use Unwrap which works perfectly but now I cannot select an item and paa it to my bean.

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

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



More information about the jboss-user mailing list