1 Reply Latest reply on Jun 4, 2011 5:03 AM by Dave Chen

    ValueExpression.setValue does not work upon upgrade from JBoss 5.0 to 5.1

    Jesper Tejlgaard Newbie

      Hi

       

      I've tried updating JBoss 5.0.1 to 5.1.0.GA, but my JSF application fails, because of a utility method used on almost every page is no longer working.

       

      The utility method is using a value expression to set a managed bean into its proper scope after a search request has been performed.

       

      I.e.

       

      MyManagedBean bean = search(inputvalues);

      setManagedBean("fooBean", bean);

       

      And the utility method implementation:

       

      public static <T> void setManagedBean(String binding, T bean) { 

         FacesContext ctx = FacesContext.getCurrentInstance();

         ELContext elCtx = ctx.getELContext();

         ExpressionFactory factory = ctx.getApplication().getExpressionFactory();

         String exp = "#{"+binding+"}";

         ValueExpression valueExp = factory.createValueExpression(elCtx, exp, bean.getClass());

         valueExp.setValue(elCtx, bean);

      }

       

      What happens upon execution is that an empty instance of MyManagedBean is inserted, i.e. all field values are gone. Does anyone have a clue on why this behavior occures now?

       

       

      We have created a basic JSF 1.2 web application compiled against JSF RI 1.2_08 and packaged with Facelets 1.1.15.B1 and Richfaces 3.3.1.GA.

      It seems that JBoss 5.1 executes with Mojarra 1.2_12-b01-FCS, is that a change?

       

      JDK version is 1.6.0_22

       

      Feel free to ask any questions if I left out important information.

       

      /Jesper