[jboss-user] [JBoss Seam] - Re: Parameters not sent when using s:selectItems

marius.oancea do-not-reply at jboss.com
Fri Nov 16 11:10:37 EST 2007


In plain words what i have is:

MRPList.xhtml (snap)
====================
            <s:decorate template="layout/display.xhtml">
  |                 <ui:define name="label">Committee</ui:define>
  |                 <h:selectOneMenu id="cmtid" value="#{markupRepresentationList.criteria.committee}">
  |                     <s:selectItems value="#{committeeList.resultList}"
  |                                    var="committee"
  |                                    label="#{committee.title}" />
  |                 </h:selectOneMenu>
  |                 
  |              </s:decorate>
  | 


MRPList.page.xml
================

<?xml version="1.0" encoding="UTF-8"?>
  | <page xmlns="http://jboss.com/products/seam/pages"
  |       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |       xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
  |       
  |    <param name="firstResult" value="#{markupRepresentationList.firstResult}"/>
  |    <param name="order" value="#{markupRepresentationList.order}"/>
  |    <param name="from"/>
  |    <param name="fulltext" value="#{markupRepresentationList.criteria.fulltext}"/>
  |    <param name="cmtid" value="#{markupRepresentationList.criteria.committee}"/>
  | </page>
  | 
  | 




  | @Name("markupRepresentationList")
  | public class MarkupRepresentationList extends EntityQuery {
  | 
  | 	private static final String[] RESTRICTIONS = {
  | 			"term.name like concat(#{markupRepresentationList.criteria.fulltext},'%')",
  | 			"concept.sourceReference.ownerComittee.id=#{markupRepresentationList.criteria.committee}",
  | 			};
  | 
  | 	private MarkupSearchCriteria criteria = new MarkupSearchCriteria();
  | 
  | 	@Override
  | 	public String getEjbql() {
  | 		return "select term from Markup term, IN (term.concepts) concept";
  | 	}
  | 
  | 	@Override
  | 	public Integer getMaxResults() {
  | 		return 5;
  | 	}
  | 
  | 
  | 	public MarkupSearchCriteria getCriteria() {
  | 		return criteria;
  | 	}
  | 
  | 	@Override
  | 	public List<String> getRestrictions() {
  | 		return Arrays.asList(RESTRICTIONS);
  | 	}
  | 
  | }
  | 
  | 
  | 
  | 
  | public class MarkupSearchCriteria {
  | 	private String fulltext;
  | 	private Integer committee;
  | 
  | 	public String getFulltext() {
  | 		return fulltext;
  | 	}
  | 
  | 	public void setFulltext(String fulltext) {
  | 		this.fulltext = fulltext;
  | 	}
  | 
  | 	public Integer getCommittee() {
  | 		return committee;
  | 	}
  | 
  | 	public void setCommittee(Integer committee) {
  | 		this.committee = committee;
  | 	}
  | 
  | }
  | 

I also tried to create a convertor for Committee:

@Name("committeeConvertor")
  | @org.jboss.seam.annotations.faces.Converter(forClass=Committee.class)
  | public class CommitteeConvertor implements Converter, Serializable{
  | 
  | 	   @In
  | 	   private EntityManager entityManager;
  | 	   
  | 	   @Transactional
  | 	   public Object getAsObject(FacesContext context, UIComponent component, String value)
  | 	   {
  | 	      if (value != null)
  | 	      {
  | 	         try 
  | 	         {
  | 	            Integer id = Integer.parseInt(value);
  | 	            if (id != null)
  | 	            {
  | 	               return entityManager.find(Committee.class, id);
  | 	            }
  | 	         } 
  | 	         catch (NumberFormatException e) {
  | 	         }
  | 	      }
  | 	      return null;     
  | 	   }
  | 
  | 	   public String getAsString(FacesContext context, UIComponent component, Object value)
  | 	   {
  | 	      if (value instanceof Committee)
  | 	      {
  | 	    	 Committee c = (Committee) value;
  | 	         return "" + c.getId();
  | 	      }
  | 	      else
  | 	      {
  | 	         return null;
  | 	      }
  | 	   }
  | 
  | }
  | 

What i want id to have cmtid synchronised with    #{markupRepresentationList.criteria.committee}, so that query can use it.



I've tried to explicitelly use the convertor but nothing works.

Any clue ? Is there any limits by using the combination: event component, "param" in pages and s:selectItems? Any howto?

I was able to make the application working when parameter is specified : 
MRPList.seam?cmtid=1

But combo was not updated.

Please help :((

[/img]

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

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



More information about the jboss-user mailing list