[jboss-user] [JBoss Seam] - <s:selectItems and noSelectionLabel

hager do-not-reply at jboss.com
Tue Sep 11 13:33:42 EDT 2007


hello,
I have some problems with the noSelectionLabel attribute,

I want to make a research by collaborator's type.
collaborateur's type is a String
for example : when i choose the type "interne" from the selectOneMenu, i obtain all collaborators which have intern type.
my problem is, when i put the noSelectionLabel attribute, the research is wrong, but when i remove it, i have the appropriate collaborators.
but i have to use the noSelectionLabel attribute.

in page.xhtml

<ui:define name="label">#{msgCollaborateur.type}</ui:define>
  |  <h:selectOneMenu id="selectOneType"                 				 value="#{collaborateurList.collaborateur.type}">
  | <s:selectItems value="#{collaborateurHome.typeCollaborateurKeys}"			 var="typeCollaborateurIterator"					   label="#{collaborateurHome.typeCollaborateurMap[typeCollaborateurIterator]}"
  | id="selectType"
  | noSelectionLabel="all Types"/>
  | </h:selectOneMenu>

in collaborateurHome.java:

  | package com.fitnetapplication.resources.model;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.framework.EntityQuery;
  | import java.util.List;
  | import java.util.Arrays;
  | 
  | @Name("collaborateurList")
  | public class CollaborateurList extends EntityQuery {
  | 	
  | 	@In(required=false)
  | 	Societe currentSociete;
  | 	
  | 	
  | 	
  | 	private static final String[] RESTRICTIONS = {
  | 			"lower(collaborateur.type) like concat(lower(#{collaborateurList.collaborateur.type}),'%')",
  | 			"lower(collaborateur.nom) like concat(lower(#{collaborateurList.collaborateur.nom}),'%')",
  | 			"lower(collaborateur.prenom1) like concat(lower(#{collaborateurList.collaborateur.prenom1}),'%')",
  | 			};
  | 
  | 	private Collaborateur collaborateur = new Collaborateur();
  | 
  | 	@Override
  | 	public String getEjbql() {
  | 		
  | 		if(currentSociete != null){
  | 			return "select collaborateur from Collaborateur collaborateur where collaborateur.societe = #{currentSociete}";
  | 		}
  | 		return "select collaborateur from Collaborateur collaborateur";
  | 
  | 	}
  | 
  | 	@Override
  | 	public Integer getMaxResults() {
  | 		return 25;
  | 	}
  | 
  | 	public Collaborateur getCollaborateur() {
  | 		return collaborateur;
  | 	}
  | 
  | 	@Override
  | 	public List<String> getRestrictions() {
  | 		return Arrays.asList(RESTRICTIONS);
  | 		
  | 	}
  | 	
  | 	
  | 	@Override public List<Collaborateur> getResultList()
  | 	{
  | 		List<Collaborateur> a=super.getResultList();
  | 		System.out.println("EJBQL = " + super.getRenderedEjbql());
  | 		return a;
  | 	}
  | 	
  | 
  | }

 thanks.

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

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



More information about the jboss-user mailing list