[jboss-user] [JBoss Seam] - Re: selectOneMenu and commandButton conflict

grdzeli_kaci do-not-reply at jboss.com
Tue Feb 20 09:02:02 EST 2007


i tryed to use another ways.

here is fragment of my program :

1. login page:

  | <h:selectOneMenu styleClass="font_style" value="#{application.name}" converter="#{converters.applicationConverter}">
  |                                         <s:selectItems value="#{applications.resultList}" var="application" label="#{application.name}"/>
  |                                     </h:selectOneMenu>
  | 

2. components.xml

  |    <framework:entity-query name="applications" ejbql="select a from Application a" />
  |     <framework:entity-home name="applicationHome" entity-class="com.magti.seam.beans.billAdmin.Application"/>
  |     <factory name="application" value="#{applicationHome.instance}" />
  | 

3. My Converter :

  | @Transactional
  |     public Converter getApplicationConverter() {
  |         return new Converter() {
  |             
  |             @Transactional
  |             public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) throws ConverterException {
  |                 if (arg2 == null) {
  |                     return null;
  |                 }
  |                 try {
  |                     return  ((EntityManager) Component.getInstance("entityManager")).find(Application.class, Long.valueOf(arg2));
  |                 } catch (NumberFormatException e) {
  |                     throw new ConverterException("Cannot Find Selected Language", e);
  |                 }
  |             }
  |             
  |             @Transactional
  |             public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) throws ConverterException {
  |                 if (arg2 instanceof Application) {
  |                     Application application = (Application) arg2;
  |                     return application.getApplicationId().toString();
  |                 } else {
  |                     return null;
  |                 }
  |             }
  |             
  |         };
  |     }    
  | 

4. and entity bean i posted above, but i remove @Name annotation.

but error still appears,


  | /login.xhtml @37,153 value="#{application.name}": Exception setting property name of base with class com.magti.seam.beans.billAdmin.Application, Bean: com.magti.seam.beans.billAdmin.Application, property: name, argument type mismatch
  | 

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

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



More information about the jboss-user mailing list