1 2 Previous Next 17 Replies Latest reply on Mar 28, 2012 7:56 PM by lightguard

    selectOneMenu CDI @Named invalid value problem

    ben_utzer

      Hi guys,


      I'm back with another problem that keeps me puzzling.


      I have a named session scoped bean CustomerRegistration which has a named producer method getNewCustomer which returns a Customer object. There is also a CustomerListProducer class which produces all customers as list from the database.
      On the selectCustomer.xhtml page the user is then able to select one of the customers and submit the selection to the application which then simply prints out the last name of the selected customer.


      Now this only works when I reference the selected customer on the facelets page via #{customerRegistration.newCustomer}. When I simply use #{newCustomer} which to my understanding should also work then JSF reports (javax.faces.PROJECT_STAGE=DEVELOPMENT) a validation error complaining about an invalid value whenever I submit the form.


      What's going on here?


      pom.xml:




      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
           <modelVersion>4.0.0</modelVersion>
           <groupId>de.beracom</groupId>
           <artifactId>helloworld_as7</artifactId>
           <version>0.0.1-SNAPSHOT</version>
           <packaging>war</packaging>
      
           <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      
                <seam.bom.version>3.1.0.Beta2</seam.bom.version>
                <jboss.javaee6.version>2.0.0.Final</jboss.javaee6.version>
                <jodatime.version>1.6.2</jodatime.version>
                <arquillian.version>1.0.0.CR4</arquillian.version>
                <arquillian.jbossas7.version>7.0.1.Final</arquillian.jbossas7.version>
                <richfaces.version>4.0.0.Final</richfaces.version>
                <prettyfaces.version>3.3.0</prettyfaces.version>
                <junit.version>4.8.2</junit.version>
      
                <jbossas.7.version>7.0.1.Final</jbossas.7.version>
           </properties>
      
           <dependencyManagement>
                <dependencies>
      
                     <dependency>
                          <groupId>org.jboss.seam</groupId>
                          <artifactId>seam-bom</artifactId>
                          <version>${seam.bom.version}</version>
                          <type>pom</type>
                          <scope>import</scope>
                     </dependency>
                     <dependency>
                          <groupId>org.richfaces</groupId>
                          <artifactId>richfaces-bom</artifactId>
                          <version>${richfaces.version}</version>
                          <type>pom</type>
                          <scope>import</scope>
                     </dependency>
                     <dependency>
                          <groupId>org.jboss.spec</groupId>
                          <artifactId>jboss-javaee-6.0</artifactId>
                          <version>${jboss.javaee6.version}</version>
                          <type>pom</type>
                          <scope>import</scope>
                          <exclusions>
                               <exclusion>
                                    <groupId>org.apache.xalan</groupId>
                                    <artifactId>xalan</artifactId>
                               </exclusion>
                          </exclusions>
                     </dependency>
                </dependencies>
           </dependencyManagement>
      
           <dependencies>
      
                <dependency>
                     <groupId>xalan</groupId>
                     <artifactId>xalan</artifactId>
                     <version>2.7.1</version>
                </dependency>
      
                <dependency>
      
                     <groupId>org.jboss.seam.servlet</groupId>
      
                     <artifactId>seam-servlet</artifactId>
      
                </dependency>
                <dependency>
                     <groupId>org.jboss.seam.faces</groupId>
                     <artifactId>seam-faces</artifactId>
                </dependency>
                <dependency>
                     <groupId>org.jboss.seam.international</groupId>
                     <artifactId>seam-international</artifactId>
                </dependency>
                <dependency>
                     <groupId>org.jboss.seam.catch</groupId>
                     <artifactId>seam-catch</artifactId>
                </dependency>
                <dependency>
                     <groupId>org.jboss.seam.security</groupId>
                     <artifactId>seam-security</artifactId>
                </dependency>
                <dependency>
                     <groupId>org.jboss.seam.config</groupId>
                     <artifactId>seam-config-xml</artifactId>
                </dependency>
                <dependency>
                     <groupId>org.jboss.seam.persistence</groupId>
                     <artifactId>seam-persistence</artifactId>
                </dependency>
                <dependency>
                     <groupId>org.jboss.seam.validation</groupId>
                     <artifactId>seam-validation</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.seam.solder</groupId>
                     <artifactId>seam-solder-tooling</artifactId>
                     <scope>provided</scope>
                </dependency>
                <dependency>
                     <groupId>joda-time</groupId>
                     <artifactId>joda-time</artifactId>
                     <version>${jodatime.version}</version>
                </dependency>
                
                <dependency>
                     <groupId>com.ocpsoft</groupId>
                     <artifactId>prettyfaces-jsf2</artifactId>
                     <version>${prettyfaces.version}</version>
                     <scope>runtime</scope>
                </dependency>
                <dependency>
                     <groupId>org.jboss.seam.transaction</groupId>
                     <artifactId>seam-transaction</artifactId>
                </dependency>
      
                <dependency>
                     <groupId>org.jboss.arquillian.junit</groupId>
                     <artifactId>arquillian-junit-container</artifactId>
                     <version>${arquillian.version}</version>
                     <scope>test</scope>
                </dependency>
                <dependency>
                     <groupId>junit</groupId>
                     <artifactId>junit</artifactId>
                     <version>${junit.version}</version>
                     <scope>test</scope>
                </dependency>
                <dependency>
                     <groupId>org.jboss.shrinkwrap.resolver</groupId>
                     <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
                     <version>1.0.0-beta-3</version>
                     <scope>test</scope>
                </dependency>
      
                <!-- Import the CDI API, we use provided scope as the API is included in 
                     JBoss AS 7 -->
                <dependency>
                     <groupId>javax.enterprise</groupId>
                     <artifactId>cdi-api</artifactId>
                     <scope>provided</scope>
                </dependency>
      
                <!-- Import the Common Annotations API (JSR-250), we use provided scope 
                     as the API is included in JBoss AS 7 -->
                <dependency>
                     <groupId>org.jboss.spec.javax.annotation</groupId>
                     <artifactId>jboss-annotations-api_1.1_spec</artifactId>
                     <scope>provided</scope>
                </dependency>
      
                <!-- Import the Servlet API, we use provided scope as the API is included 
                     in JBoss AS 7 -->
                <dependency>
                     <groupId>org.jboss.spec.javax.servlet</groupId>
                     <artifactId>jboss-servlet-api_3.0_spec</artifactId>
                     <scope>provided</scope>
                </dependency>
      
                
           </dependencies>
      
           <build>
                <plugins>
      
                     <!-- This plugin config is used to set the Dependencies entry in META-INF/MANIFEST.MF 
                          so that in AS7 both JBoss Logging and the JBoss Log manager will be available 
                          in the classpath -->
                     <plugin>
                          <artifactId>maven-compiler-plugin</artifactId>
                          <configuration>
                               <source>1.6</source>
                               <target>1.6</target>
                          </configuration>
                     </plugin>
                     <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-war-plugin</artifactId>
                          <configuration>
                               <failOnMissingWebXml>false</failOnMissingWebXml>
                               <archive>
                                    <manifestEntries>
                                         <Dependencies>org.jboss.logging,org.jboss.logmanager,org.apache.log4j,org.slf4j</Dependencies>
                                    </manifestEntries>
                               </archive>
                          </configuration>
                     </plugin>
                     
                </plugins>
           </build>
      </project>



      Resources.java:




      package util;
      
      import javax.enterprise.context.SessionScoped;
      import javax.enterprise.inject.Produces;
      import javax.persistence.EntityManagerFactory;
      import javax.persistence.PersistenceUnit;
      
      import org.jboss.seam.solder.core.ExtensionManaged;
      
      /**
       * This class uses CDI to alias Java EE resources, such as the persistence
       * context, to CDI beans
       * 
       * <p>
       * Example injection on a managed bean field:
       * </p>
       * 
       * <pre>
       * &#064;Inject
       * private EntityManager em;
       * </pre>
       */
      public class Resources {
           // use @SuppressWarnings to tell IDE to ignore warnings about field not
           // being referenced directly
           @SuppressWarnings("unused")
           @ExtensionManaged
           @SessionScoped
           @Produces
           @PersistenceUnit
           private EntityManagerFactory emf;
      }



      CustomerConverter.java:




      package util;
      
      import java.io.Serializable;
      
      import javax.enterprise.context.SessionScoped;
      import javax.faces.component.UIComponent;
      import javax.faces.context.FacesContext;
      import javax.faces.convert.Converter;
      import javax.faces.convert.FacesConverter;
      import javax.inject.Inject;
      import javax.persistence.EntityManager;
      
      import domain.Customer;
      
      @SessionScoped
      @FacesConverter(forClass = Customer.class)
      public class CustomerConverter implements Converter, Serializable {
           private static final long serialVersionUID = -6093400626095413322L;
      
           @Inject
           EntityManager entityManager;
      
           @Override
           public Object getAsObject(FacesContext context, UIComponent component,
                     String value) {
                Long id = Long.valueOf(value);
                return entityManager.find(Customer.class, id);
           }
      
           @Override
           public String getAsString(FacesContext context, UIComponent component,
                     Object value) {
                return ((Customer) value).getId().toString();
           }
      
      }
      



      Customer.java:




      package domain;
      
      import java.io.Serializable;
      
      import javax.persistence.Column;
      import javax.persistence.GeneratedValue;
      import javax.persistence.Id;
      
      import org.jboss.seam.solder.core.Veto;
      
      @javax.persistence.Entity
      @Veto
      public class Customer implements Serializable, Entity {
           private static final long serialVersionUID = 122193054725297662L;
           @Column(name = "first_name")
           private String firstName;
           @Column(name = "last_name")
           private String lastName;
           @Id
           @GeneratedValue()
           private Long id;
      
           public String getFirstName() {
                return firstName;
           }
      
           public void setFirstName(String firstName) {
                this.firstName = firstName;
           }
      
           public String getLastName() {
                return lastName;
           }
      
           public void setLastName(String lastName) {
                this.lastName = lastName;
           }
      
           @Override
           public String toString() {
                return firstName + ", " + lastName;
           }
      
           @Override
           public Long getId() {
                return this.id;
           }
      }



      CustomerListProducer.java:




      package data;
      
      import java.io.Serializable;
      import java.util.List;
      
      import javax.annotation.PostConstruct;
      import javax.enterprise.context.SessionScoped;
      import javax.enterprise.event.Observes;
      import javax.enterprise.event.Reception;
      import javax.enterprise.inject.Produces;
      import javax.inject.Inject;
      import javax.inject.Named;
      import javax.persistence.EntityManager;
      import javax.persistence.criteria.CriteriaBuilder;
      import javax.persistence.criteria.CriteriaQuery;
      import javax.persistence.criteria.Root;
      
      import org.jboss.seam.logging.Category;
      import org.jboss.seam.logging.Logger;
      
      import domain.Customer;
      
      @SessionScoped
      public class CustomerListProducer implements Serializable {
      
           @Inject
           private EntityManager em;
      
           private List<Customer> customers;
           
           @Inject
           @Category("helloworld_as7")
           Logger log;
      
           // @Named provides access the return value via the EL variable name
           // "members" in the UI (e.g.,
           // Facelets or JSP view)
           @Produces
           @Named
           public List<Customer> getCustomers() {
                return customers;
           }
      
           public void onCustomerListChanged(
                     @Observes(notifyObserver = Reception.IF_EXISTS) final Customer customer) {
      //          retrieveAllCustomersOrderedByName();
                log.info(customer.toString());
           }
      
           @PostConstruct
           public void retrieveAllCustomersOrderedByName() {
                CriteriaBuilder cb = em.getCriteriaBuilder();
                CriteriaQuery<Customer> criteria = cb.createQuery(Customer.class);
                Root<Customer> customer = criteria.from(Customer.class);
                // Swap criteria statements if you would like to try out type-safe
                // criteria queries, a new
                // feature in JPA 2.0
                // criteria.select(member).orderBy(cb.asc(member.get(Member_.name)));
                criteria.select(customer).orderBy(cb.asc(customer.get("lastName")));
                customers = em.createQuery(criteria).getResultList();
           }
      }
      



      CustomerRegistration.java:




      package controller;
      
      import java.io.Serializable;
      
      import javax.annotation.PostConstruct;
      import javax.enterprise.context.SessionScoped;
      import javax.enterprise.inject.Produces;
      import javax.inject.Inject;
      import javax.inject.Named;
      
      import org.jboss.seam.logging.Category;
      import org.jboss.seam.logging.Logger;
      
      import domain.Customer;
      
      @Named
      @SessionScoped
      public class CustomerRegistration implements Serializable {
      
           @Inject
           @Category("helloworld_as7")
           private Logger log;
      
           private Customer newCustomer;
      
           @Produces
           @Named
           public Customer getNewCustomer() {
                return newCustomer;
           }
      
           public void selected() {
                log.info("Customer " + newCustomer.getLastName() + " ausgewählt.");
           }
      
           @PostConstruct
           public void initNewCustomer() {
                newCustomer = new Customer();
           }
      
           public void setNewCustomer(Customer newCustomer) {
                this.newCustomer = newCustomer;
           }
      
      }
      



      selectCustomer.xhtml (JSF complains about invalid value after submitting the selected customer):




      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html
          PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:ui="http://java.sun.com/jsf/facelets">
      <h:head>
           <title>Auswahl</title>
      </h:head>
      <h:body>
           <h:form>
                <h:selectOneMenu value="#{newCustomer}">
                     <f:selectItems value="#{customers}" var="current"
                          itemLabel="#{current.firstName}, #{current.lastName}" />
                </h:selectOneMenu>
                <h:panelGroup id="auswahl">
                     <h:outputText value="#{newCustomer.lastName}" />
                </h:panelGroup>
                <h:commandButton value="Klick"
                     action="#{customerRegistration.selected}" />
           </h:form>
      </h:body>
      </html>




      selectCustomer.xhtml (working):




      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html
          PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:ui="http://java.sun.com/jsf/facelets">
      <h:head>
           <title>Auswahl</title>
      </h:head>
      <h:body>
           <h:form>
                <h:selectOneMenu value="#{customerRegistration.newCustomer}">
                     <f:selectItems value="#{customers}" var="current"
                          itemLabel="#{current.firstName}, #{current.lastName}" />
                </h:selectOneMenu>
                <h:panelGroup id="auswahl">
                     <h:outputText value="#{newCustomer.lastName}" />
                </h:panelGroup>
                <h:commandButton value="Klick"
                     action="#{customerRegistration.selected}" />
           </h:form>
      </h:body>
      </html>














        • 1. Re: selectOneMenu CDI @Named invalid value problem
          ssachtleben.ssachtleben.gmail.com

          Try to provide hashcode and equals methods for Customer entity.
          Seems like the faces converter returns a object which doesnt match against any value in the provided list.


          I have already started to write a blog post about how to use selectOneMenu properly, but its not done and published yet.
          Maybe this week, currently I'm very busy :(


          • 2. Re: selectOneMenu CDI @Named invalid value problem
            ben_utzer

            Hi Sebastian and thanks for your quick reply.


            I've already tried with implementing hash and equals, unfortunately to no avail. So I'm quite eager to read your blog entry hoping you will describe this very use case :)

            • 3. Re: selectOneMenu CDI @Named invalid value problem
              ssachtleben.ssachtleben.gmail.com

              Well I think the best solution is to provide the same list for selectOneMenu and the faces converter.


              Try to inject the list of customers in your faces converter and compare the entries similiar to this:


              /**
               * @author Sebastian Sachtleben
               */
              @RequestScoped
              @FacesConverter(forClass = InserationBrand.class)
              public class InserationBrandConverter implements Converter {
              
                   @Inject
                   @StaticData
                   private List<InserationBrand> brands;
              
                   @Override
                   public Object getAsObject(FacesContext context, UIComponent component, String newValue) {
                        for (InserationBrand brand : brands) {
                             if (brand.getName().equals(newValue)) {
                                  return brand;
                             }
                        }
                        return null;
                   }
              
                   @Override
                   public String getAsString(FacesContext context, UIComponent component, Object value) {
                        String name = "";
                        try {
                             InserationBrand brand = (InserationBrand) value;
                             name = brand.getName();
                        } catch (Throwable e) {
                        }
                        return name;
                   }
              
              }

              • 4. Re: selectOneMenu CDI @Named invalid value problem
                ben_utzer

                Well, is it really a converter issue? The converter doesn't even get called!
                Please compare the following logs.


                Working log:




                ...
                13:36:14,154 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Entering ProcessValidationsPhase
                13:36:14,170 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) Created converter of type 'util.CustomerConverter'
                13:36:14,170 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) Created converter (util.CustomerConverter$Proxy$_$$_WeldClientProxy) for type java.lang.Class for component j_idt8.
                13:36:20,136 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) SelectOne Component  j_idt8 convertedValue Max, Mustermann
                13:36:29,335 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Exiting ProcessValidationsPhase
                13:36:29,523 FEIN  [javax.enterprise.resource.webcontainer.jsf.timing] (http--127.0.0.1-8080-3)  [TIMING] - [15369ms] : Execution time for phase (including any PhaseListeners) -> PROCESS_VALIDATIONS 3
                13:36:29,726 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Entering UpdateModelValuesPhase
                13:36:29,726 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Exiting UpdateModelValuesPhase
                13:36:29,741 FEIN  [javax.enterprise.resource.webcontainer.jsf.timing] (http--127.0.0.1-8080-3)  [TIMING] - [31ms] : Execution time for phase (including any PhaseListeners) -> UPDATE_MODEL_VALUES 4
                13:36:29,772 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Entering InvokeApplicationsPhase
                13:36:29,772 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) processAction(j_idt11)
                13:36:29,772 INFO  [helloworld_as7] (http--127.0.0.1-8080-3) Customer Mustermann ausgewählt.
                13:36:29,819 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Exiting InvokeApplicationsPhase
                13:36:29,851 FEIN  [javax.enterprise.resource.webcontainer.jsf.timing] (http--127.0.0.1-8080-3)  [TIMING] - [94ms] : Execution time for phase (including any PhaseListeners) -> INVOKE_APPLICATION 5
                13:36:30,194 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) render(com.sun.faces.context.FacesContextImpl@bd5fa1)
                13:36:30,210 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Entering RenderResponsePhase
                13:36:30,210 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) About to render view /selectCustomer.xhtml
                13:36:30,210 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) URL pattern of the FacesServlet executing the current request .xhtml
                13:36:30,225 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @9,9 <h:head> Component[761611486_2d6544c4] Found, marking children for cleanup
                13:36:30,225 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @12,9 <h:body> Component[761611486_2d6544ea] Found, marking children for cleanup
                13:36:30,225 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @13,10 <h:form> Component[761611486_2d654490] Found, marking children for cleanup
                13:36:30,225 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @14,64 <h:selectOneMenu> Component[761611486_2d6544b6] Found, marking children for cleanup
                13:36:30,225 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @16,61 <f:selectItems> Component[761611486_2d65445c] Found, marking children for cleanup
                13:36:30,241 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @18,30 <h:panelGroup> Component[761611486_2d654451] Found, marking children for cleanup
                13:36:30,241 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @19,73 <h:outputText> Component[761611486_2d654477] Found, marking children for cleanup
                13:36:30,241 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @22,48 <h:commandButton> Component[761611486_2d654468] Found, marking children for cleanup
                13:36:30,241 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) Rendering View: /selectCustomer.xhtml
                13:36:30,257 AM FEINSTEN [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) Facelet specified alternate encoding UTF-8
                13:36:30,257 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) URL pattern of the FacesServlet executing the current request .xhtml
                13:36:30,257 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) URL pattern of the FacesServlet executing the current request .xhtml
                13:36:31,475 FEINER [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) Rendering 'select'
                13:36:31,475 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) Created converter of type 'util.CustomerConverter'
                13:36:32,740 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) Created converter of type 'util.CustomerConverter'
                13:36:36,332 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) component.getValue() returned Mustermann
                13:36:36,332 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) Value to be rendered Mustermann
                13:36:39,565 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) Begin writing marker for viewId /selectCustomer.xhtml
                ...





                not working log:



                ...
                13:40:21,796 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-4) Entering ProcessValidationsPhase
                13:40:21,812 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-4) No conversion necessary for value 2 of component j_idt8
                13:40:21,812 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-4) SelectOne Component  j_idt8 convertedValue 2
                13:40:21,828 FEIN  [javax.enterprise.resource.webcontainer.jsf.context] (http--127.0.0.1-8080-4) Adding Message[sourceId=j_idt7:j_idt8,summary=j_idt7:j_idt8: Überprüfungsfehler: Wert ist ungültig.)
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-4) Exiting ProcessValidationsPhase
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.timing] (http--127.0.0.1-8080-4)  [TIMING] - [78ms] : Execution time for phase (including any PhaseListeners) -> PROCESS_VALIDATIONS 3
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-4) render(com.sun.faces.context.FacesContextImpl@3e7f0a)
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-4) Entering RenderResponsePhase
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-4) About to render view /selectCustomer.xhtml
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-4) URL pattern of the FacesServlet executing the current request .xhtml
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-4) /selectCustomer.xhtml @9,9 <h:head> Component[761611486_2d6544c4] Found, marking children for cleanup
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-4) /selectCustomer.xhtml @12,9 <h:body> Component[761611486_2d6544ea] Found, marking children for cleanup
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-4) /selectCustomer.xhtml @13,10 <h:form> Component[761611486_2d654490] Found, marking children for cleanup
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-4) /selectCustomer.xhtml @14,43 <h:selectOneMenu> Component[761611486_2d6544b6] Found, marking children for cleanup
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-4) /selectCustomer.xhtml @16,61 <f:selectItems> Component[761611486_2d65445c] Found, marking children for cleanup
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-4) /selectCustomer.xhtml @18,30 <h:panelGroup> Component[761611486_2d654451] Found, marking children for cleanup
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-4) /selectCustomer.xhtml @19,52 <h:outputText> Component[761611486_2d654477] Found, marking children for cleanup
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-4) /selectCustomer.xhtml @22,48 <h:commandButton> Component[761611486_2d654468] Found, marking children for cleanup
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-4) Rendering View: /selectCustomer.xhtml
                13:40:21,843 AM FEINSTEN [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-4) Facelet specified alternate encoding UTF-8
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-4) URL pattern of the FacesServlet executing the current request .xhtml
                13:40:21,843 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-4) URL pattern of the FacesServlet executing the current request .xhtml
                13:41:11,587 FEINER [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-4) Rendering 'select'
                13:41:11,587 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-4) Created converter of type 'util.CustomerConverter'
                13:41:18,631 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-4) Created converter of type 'util.CustomerConverter'
                13:41:29,142 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-4) component.getValue() returned null
                13:41:29,142 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-4) Value to be rendered null
                ...



                • 5. Re: selectOneMenu CDI @Named invalid value problem
                  ben_utzer

                  The interesting part is that obviously JSF doesn't create the converter in the ProcessValidationsPhase when I reference #{newCustomer} as opposed to #{customerRegistration.newCustomer}.


                  How can i further investigate this problem? What's the best way to debug the libraries that are already included in JBoss AS 7 in Eclipse?

                  • 6. Re: selectOneMenu CDI @Named invalid value problem
                    ssachtleben.ssachtleben.gmail.com

                    Try to add the converter to selectOneMenu:


                    <f:converter converterId="customerConverter" />



                    and add to faces-config.xml:


                    <converter>
                         <converter-id>customerConverter</converter-id>
                         <converter-class>util.CustomerConverter</converter-class>
                    </converter>



                    • 7. Re: selectOneMenu CDI @Named invalid value problem
                      ben_utzer

                      Ah yes, that's what I did. Well actually, I removed @FacesConverter(forClass = Customer.class) with @FacesConverter("customerConverter")


                      and now the converter is created in the ProcessValidationsPhase but it's still not working. Is this a bug btw?



                      ...
                      Entering ProcessValidationsPhase
                      14:00:42,671 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) SelectOne Component  j_idt8 convertedValue Max, Mustermann
                      14:00:42,702 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Exiting ProcessValidationsPhase
                      14:00:42,702 FEIN  [javax.enterprise.resource.webcontainer.jsf.timing] (http--127.0.0.1-8080-3)  [TIMING] - [3686ms] : Execution time for phase (including any PhaseListeners) -> PROCESS_VALIDATIONS 3
                      14:00:42,718 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Entering UpdateModelValuesPhase
                      14:00:42,718 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Exiting UpdateModelValuesPhase
                      14:00:42,718 FEIN  [javax.enterprise.resource.webcontainer.jsf.timing] (http--127.0.0.1-8080-3)  [TIMING] - [16ms] : Execution time for phase (including any PhaseListeners) -> UPDATE_MODEL_VALUES 4
                      14:00:42,734 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Entering InvokeApplicationsPhase
                      14:00:42,734 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) processAction(j_idt11)
                      14:00:42,749 INFO  [helloworld_as7] (http--127.0.0.1-8080-3) Customer null ausgewählt.
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Exiting InvokeApplicationsPhase
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.timing] (http--127.0.0.1-8080-3)  [TIMING] - [62ms] : Execution time for phase (including any PhaseListeners) -> INVOKE_APPLICATION 5
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) render(com.sun.faces.context.FacesContextImpl@1ba4c02)
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) Entering RenderResponsePhase
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http--127.0.0.1-8080-3) About to render view /selectCustomer.xhtml
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) URL pattern of the FacesServlet executing the current request .xhtml
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @9,9 <h:head> Component[761611486_2d6544c4] Found, marking children for cleanup
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @12,9 <h:body> Component[761611486_2d6544ea] Found, marking children for cleanup
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @13,10 <h:form> Component[761611486_2d654490] Found, marking children for cleanup
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @14,73 <h:selectOneMenu> Component[761611486_2d6544b6] Found, marking children for cleanup
                      14:00:42,780 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @16,61 <f:selectItems> Component[761611486_2d65445c] Found, marking children for cleanup
                      14:00:42,796 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @18,30 <h:panelGroup> Component[761611486_2d654451] Found, marking children for cleanup
                      14:00:42,796 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @19,52 <h:outputText> Component[761611486_2d654477] Found, marking children for cleanup
                      14:00:42,796 FEIN  [javax.enterprise.resource.webcontainer.jsf.facelets.tag.component] (http--127.0.0.1-8080-3) /selectCustomer.xhtml @22,48 <h:commandButton> Component[761611486_2d654468] Found, marking children for cleanup
                      14:00:42,796 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) Rendering View: /selectCustomer.xhtml
                      14:00:42,796 AM FEINSTEN [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) Facelet specified alternate encoding UTF-8
                      14:00:42,796 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) URL pattern of the FacesServlet executing the current request .xhtml
                      14:00:42,796 FEIN  [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-3) URL pattern of the FacesServlet executing the current request .xhtml
                      14:00:44,217 FEINER [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) Rendering 'select'
                      14:00:46,982 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) component.getValue() returned null
                      14:00:46,982 FEIN  [javax.enterprise.resource.webcontainer.jsf.renderkit] (http--127.0.0.1-8080-3) Value to be rendered null
                      ...





                      • 8. Re: selectOneMenu CDI @Named invalid value problem
                        ben_utzer

                        Oh but the validation error doesn't occur anymore.

                        • 9. Re: selectOneMenu CDI @Named invalid value problem
                          ben_utzer

                          Maybe my problem is related to what the JSR-299 spec mentions in chapter 7.1. Restriction upon bean instantion:





                          ...
                          However, if the application directly instantiates a bean class, instead of letting the container perform instantiation, the resulting
                          instance is not managed by the container and is not a contextual instance as defined by Section 6.5.2, “Contextual
                          instance of a bean”. Furthermore, the capabilities listed in Section 2.1, “Functionality provided by the container to the
                          bean” will not be available to that particular instance. In a deployed application, it is the container that is responsible for
                          instantiating beans and initializing their dependencies.
                          ...

                          And section 2.1.:





                          A bean is provided by the container with the following capabilities:


                          • transparent creation and destruction and scoping to a particular context, specified in Chapter 6, Scopes and contexts
                          and Chapter 7, Lifecycle of contextual instances,

                          • scoped resolution by bean type and qualifier annotation type when injected into a Java-based client, as defined by Section
                          5.2, “Typesafe resolution”,

                          • scoped resolution by name when used in a Unified EL expression, as defined by Section 5.3, “EL name resolution”,

                          • lifecycle callbacks and automatic injection of other bean instances, specified in Chapter 3, Programming model and
                          Chapter 5, Dependency injection, lookup and EL,

                          • method interception, callback interception, and decoration, as defined in Chapter 9, Interceptor bindings and
                          Chapter 8, Decorators, and

                          • event notification, as defined in Chapter 10, Events.


                          So does this mean I have to remove @Veto from my entity bean? Otoh, this is what the Seam or Weld docs recommend me to do...


                          • 10. Re: selectOneMenu CDI @Named invalid value problem
                            ssachtleben.ssachtleben.gmail.com

                            It works for me fine with @Veto on entity and the converter mentioned above.


                            But I'm not sure about your problem.

                            • 11. Re: selectOneMenu CDI @Named invalid value problem
                              ben_utzer

                              Could you provide your solution please? I just can't get it working...

                              • 12. Re: selectOneMenu CDI @Named invalid value problem
                                ssachtleben.ssachtleben.gmail.com

                                Here we go:


                                /**
                                 * Identifies the values as static data.
                                 * 
                                 * @author Sebastian Sachtleben
                                 */
                                @Target({ METHOD, CONSTRUCTOR, FIELD })
                                @Retention(RUNTIME)
                                @Documented
                                public @interface StaticData {
                                }



                                /**
                                 * @author Sebastian Sachtleben
                                 */
                                @RequestScoped
                                @FacesConverter(forClass = InserationBrand.class)
                                public class InserationBrandConverter implements Converter {
                                
                                     @Inject
                                     @StaticData
                                     private List<InserationBrand> brands;
                                
                                     @Override
                                     public Object getAsObject(FacesContext context, UIComponent component, String newValue) {
                                          for (InserationBrand brand : brands) {
                                               if (brand.getName().equals(newValue)) {
                                                    return brand;
                                               }
                                          }
                                          return null;
                                     }
                                
                                     @Override
                                     public String getAsString(FacesContext context, UIComponent component, Object value) {
                                          String name = "";
                                          try {
                                               InserationBrand brand = (InserationBrand) value;
                                               name = brand.getName();
                                          } catch (Throwable e) {
                                          }
                                          return name;
                                     }
                                
                                }



                                /**
                                 * @author Sebastian Sachtleben
                                 */
                                @ApplicationScoped
                                public class InserationStaticDataProducer implements Serializable {
                                
                                     private static final long serialVersionUID = -857791385839267008L;
                                
                                     private final Logger log = Logger.getLogger(InserationStaticDataProducer.class);
                                
                                     @PersistenceContext
                                     private EntityManager em;
                                
                                     @Produces
                                     @StaticData
                                     private List<InserationBrand> brands;
                                
                                     @PostConstruct
                                     public void initialize() {
                                          log.info("Loading inseration static data like brands, models and movements");
                                          brands = getBrandListFromDatabase();
                                     }
                                
                                     private List<InserationBrand> getBrandListFromDatabase() {
                                          CriteriaBuilder builder = em.getCriteriaBuilder();
                                          CriteriaQuery<InserationBrand> resultQuery = builder.createQuery(InserationBrand.class);
                                          Root<InserationBrand> metamodel = resultQuery.from(InserationBrand.class);
                                          Expression<Boolean> whereExp = builder.equal(metamodel.get("visible"), true);
                                          Order orderby = builder.asc(metamodel.<String> get("name"));
                                          resultQuery.select(metamodel).where(whereExp).orderBy(orderby);
                                          return em.createQuery(resultQuery).getResultList();
                                     }
                                
                                     public List<InserationBrand> getBrands() {
                                          return brands;
                                     }
                                
                                }
                                



                                /**
                                 * @author Sebastian Sachtleben
                                 */
                                @Named
                                @ViewScoped
                                public class InserationAgent implements Serializable {
                                
                                     private static final long serialVersionUID = 5950119542352857452L;
                                
                                     private final Logger log = Logger.getLogger(InserationAgent.class);
                                
                                     @PersistenceContext
                                     private EntityManager em;
                                
                                     @Inject
                                     private InserationStaticDataProducer staticData;
                                
                                     private InserationBrand brand;
                                
                                     public List<InserationBrand> getBrands() {
                                          return staticData.getBrands();
                                     }
                                
                                     public InserationBrand getBrand() {
                                          return brand;
                                     }
                                
                                     public void setBrand(InserationBrand brand) {
                                          this.brand = brand;
                                     }
                                
                                }



                                <h:selectOneMenu id="search-brand"
                                     value="#{inserationAgent.brand}" style="width: 200px">
                                     <f:selectItem
                                          itemLabel="#{bundles.messages['inseration.refinesearch.Select']}"
                                          itemValue="#{null}" />
                                     <f:selectItems value="#{inserationAgent.brands}" var="brand"
                                          itemLabel="#{brand.name}" itemValue="#{brand}" />
                                     <f:converter converterId="inserationBrandConverter" />
                                </h:selectOneMenu>



                                I have removed a lot of unimportant stuff from InserationAgent and other producers from InserationStaticDataProducer.


                                Not sure if its the best solution but at least it works :)

                                • 13. Re: selectOneMenu CDI @Named invalid value problem
                                  ssachtleben.ssachtleben.gmail.com

                                  Ah forgot my entity. I'm sure its important to have a correct hashcode and equals without dependencies on other entites:


                                  @Entity
                                  @Table(name = "inseration_brand")
                                  @Veto
                                  public class InserationBrand implements Serializable {
                                  
                                       private static final long serialVersionUID = -7414827066878203475L;
                                  
                                       private Long id;
                                       private Long version;
                                       private Boolean visible;
                                       private Date cdate;
                                       private Date udate;
                                       private String name;
                                       private String alias;
                                       private String pattern;
                                       private String description;
                                       private List<InserationModel> models;
                                       private List<InserationEntry> inserations;
                                  
                                       public InserationBrand() {
                                            this.models = new ArrayList<InserationModel>();
                                            this.inserations = new ArrayList<InserationEntry>();
                                       }
                                  
                                       public InserationBrand(String name, String alias, String pattern) {
                                            this.name = name;
                                            this.alias = alias;
                                            this.pattern = pattern;
                                            this.cdate = new Date();
                                            this.visible = true;
                                            this.models = new ArrayList<InserationModel>();
                                            this.inserations = new ArrayList<InserationEntry>();
                                       }
                                  
                                       @Id
                                       @GeneratedValue(strategy = GenerationType.IDENTITY)
                                       public Long getId() {
                                            return id;
                                       }
                                  
                                       public void setId(Long id) {
                                            this.id = id;
                                       }
                                  
                                       @Version
                                       @Column(name = "version")
                                       public Long getVersion() {
                                            return version;
                                       }
                                  
                                       public void setVersion(Long version) {
                                            this.version = version;
                                       }
                                  
                                       @Column(name = "visible")
                                       @Type(type = "yes_no")
                                       public Boolean getVisible() {
                                            return visible;
                                       }
                                  
                                       public void setVisible(Boolean visible) {
                                            this.visible = visible;
                                       }
                                  
                                       @Column(name = "cdate")
                                       @Temporal(TemporalType.TIMESTAMP)
                                       public Date getCdate() {
                                            return cdate;
                                       }
                                  
                                       public void setCdate(Date cdate) {
                                            this.cdate = cdate;
                                       }
                                  
                                       @Column(name = "udate")
                                       @Temporal(TemporalType.TIMESTAMP)
                                       public Date getUdate() {
                                            return udate;
                                       }
                                  
                                       public void setUdate(Date udate) {
                                            this.udate = udate;
                                       }
                                  
                                       @Column(name = "name", length = 255)
                                       public String getName() {
                                            return name;
                                       }
                                  
                                       public void setName(String name) {
                                            this.name = name;
                                       }
                                  
                                       @Column(name = "alias", length = 255)
                                       public String getAlias() {
                                            return alias;
                                       }
                                  
                                       public void setAlias(String alias) {
                                            this.alias = alias;
                                       }
                                  
                                       @Column(name = "pattern", length = 255)
                                       public String getPattern() {
                                            return pattern;
                                       }
                                  
                                       public void setPattern(String pattern) {
                                            this.pattern = pattern;
                                       }
                                  
                                       @Column(name = "description", length = 10000)
                                       public String getDescription() {
                                            return description;
                                       }
                                  
                                       public void setDescription(String description) {
                                            this.description = description;
                                       }
                                  
                                       @OneToMany(mappedBy = "brand")
                                       public List<InserationModel> getModels() {
                                            return models;
                                       }
                                  
                                       public void setModels(List<InserationModel> models) {
                                            this.models = models;
                                       }
                                  
                                       @OneToMany(mappedBy = "brand")
                                       public List<InserationEntry> getInserations() {
                                            return inserations;
                                       }
                                  
                                       public void setInserations(List<InserationEntry> inserations) {
                                            this.inserations = inserations;
                                       }
                                  
                                       @Override
                                       public int hashCode() {
                                            final int prime = 31;
                                            int result = 1;
                                            result = prime * result + ((cdate == null) ? 0 : cdate.hashCode());
                                            result = prime * result + ((description == null) ? 0 : description.hashCode());
                                            result = prime * result + ((id == null) ? 0 : id.hashCode());
                                            result = prime * result + ((name == null) ? 0 : name.hashCode());
                                            result = prime * result + ((pattern == null) ? 0 : pattern.hashCode());
                                            result = prime * result + ((udate == null) ? 0 : udate.hashCode());
                                            result = prime * result + ((version == null) ? 0 : version.hashCode());
                                            result = prime * result + ((visible == null) ? 0 : visible.hashCode());
                                            return result;
                                       }
                                  
                                       @Override
                                       public boolean equals(Object obj) {
                                            if (this == obj)
                                                 return true;
                                            if (obj == null)
                                                 return false;
                                            if (getClass() != obj.getClass())
                                                 return false;
                                            InserationBrand other = (InserationBrand) obj;
                                            if (cdate == null) {
                                                 if (other.cdate != null)
                                                      return false;
                                            } else if (!cdate.equals(other.cdate))
                                                 return false;
                                            if (description == null) {
                                                 if (other.description != null)
                                                      return false;
                                            } else if (!description.equals(other.description))
                                                 return false;
                                            if (id == null) {
                                                 if (other.id != null)
                                                      return false;
                                            } else if (!id.equals(other.id))
                                                 return false;
                                            if (name == null) {
                                                 if (other.name != null)
                                                      return false;
                                            } else if (!name.equals(other.name))
                                                 return false;
                                            if (pattern == null) {
                                                 if (other.pattern != null)
                                                      return false;
                                            } else if (!pattern.equals(other.pattern))
                                                 return false;
                                            if (udate == null) {
                                                 if (other.udate != null)
                                                      return false;
                                            } else if (!udate.equals(other.udate))
                                                 return false;
                                            if (version == null) {
                                                 if (other.version != null)
                                                      return false;
                                            } else if (!version.equals(other.version))
                                                 return false;
                                            if (visible == null) {
                                                 if (other.visible != null)
                                                      return false;
                                            } else if (!visible.equals(other.visible))
                                                 return false;
                                            return true;
                                       }
                                  
                                       @Override
                                       public String toString() {
                                            return "InserationBrand [id=" + id + ", version=" + version + ", visible=" + visible + ", cdate=" + cdate + ", udate=" + udate
                                                      + ", name=" + name + ", pattern=" + pattern + ", description=" + description + "]";
                                       }
                                  
                                  }



                                  • 14. Re: selectOneMenu CDI @Named invalid value problem
                                    ben_utzer

                                    Ah well, thx, but your solution uses #{inserationAgent.brand} instead of simple #{brand}! Like I said when I use #{customerRegistration.newCustomer} instead of #{newCustomer} it also works! I'm just trying to understand why the short and to me more elegant solution does not work.


                                    I would encourage you to try out #{brand} and blog something about why this doesn't work ;)

                                    1 2 Previous Next