[jboss-user] [JBoss Seam] - SelectOneMenu problem

limousyf do-not-reply at jboss.com
Fri Dec 14 10:31:55 EST 2007


Hello,

I make a second post following hager's one as we have new informations about our problem.
The problem is about a datatable and a selectOneMenu.
The objects in the selectOneMenu can be added to the table, creating a new line (and vice-versa, a line in the datatable can be removed and goes back in the selectOneMenu)

On the business side we have two lists

- one representing the actual lines of the dataTable


  | private List<Assignable> lignes;
  | 
  | 	public List<Assignable> getLignes() 
  | 	{
  | 		return this.lignes;
  | 	}
  | 
  | 	public void setLignes(List<Assignable> lignes) 
  | 	{
  | 		this.lignes = lignes;
  | 	}
  | 

- and another representing the lines availables for adding (the lines in the selectOneMenu)


  | 	private List<Assignable> availableLines;
  | 
  | 	public List<Assignable> getAvailableLines() 
  | 	{
  | 		return availableLines;
  | 	}
  | 	
  | 	public void setAvailableLines(List<Assignable> availableLines) 
  | 	{
  | 		this.availableLines = availableLines;
  | 	}
  | 


On the view side we have:


  | 							<h:selectOneMenu id="selectOneAssignable"
  | 								value="#{activitesByCollaborateurCrossData.selectedAssignable}"
  | 								converter="#{activitesByCollaborateurCrossData.assignableConverter}">
  | 								<s:selectItems
  | 									value="#{activitesByCollaborateurCrossData.availableLines}"
  | 									var="assign" label="#{assign.designation}"
  | 									id="selectAssignable" />
  | 								
  | 							</h:selectOneMenu>
  | 							<h:commandLink action="#{activitesByCollaborateurCrossData.addAssignable}">
  | 								<h:graphicImage value="img/add.png" />
  | 								<s:conversationId />
  | 							</h:commandLink>
  | 


The problem is: when we add a line using the button, the line is actually added to the datatable, moved from one list to another in the business side (we have checked this in debug) and the getter returns the list for the selectOneMenu without the selectedObject.

But in the view the object is still in the options of the selectOneMenu !

And, of course, when we try to do something else, adding another line, doing something else in the page, etc ... there is an error in the log :


  | sourceId=activitesByCollaborateurCrossDataForm:selectOneAssignable[severity=(ERROR 2), summary=(Valeur invalide), detail=(Valeur invalide)]
  | 
  | ("Invalid Data" localized)
  | 

which looks normal because the model and the view are "desynchronized" on this list.

After the "try an action - get the invaid data error" routine, the list is correctly displayed in the selectOneMenu and we can add another line, as the model and the view are once again "synchronized" I guess.
But adding another line repeats the problem ... etc ...

Our bean is a stateful one:

  | @Stateful
  | @Scope(ScopeType.CONVERSATION)
  | @Name("activitesByCollaborateurCrossData")
  | public class activitesByCollaborateurCrossDataBean implements activitesByCollaborateurCrossData {
  | 

I initially thought it was a converting issue, as "Assignable" is interface, so I created a converter that handle all the objects implementing the interface, but it didn't change anything.

The most annoying stuff is the same code was actually working in seam 1.2
The error appeared after upgrading to Seam 2.0.0.GA + JBoss 4.2.1

Does anyone have an idea on that one ?

Regards,

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

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



More information about the jboss-user mailing list