Rob,
 
I think I can answer part of your question. The dropdown component that you're creating programatically retains its value on subsequent requests because all components retain their prior submitted values until the component values are cleared, which happens in the UPDATE_MODEL phase. It sounds like you may be using immediate=true, in which case JSF skips the UPDATE_MODEL phase. Another possibility is that your converter (or some other converter/validator on page) is generating an exception, in which case the UPDATE_MODEL phase will be skipped as with immediate=true. If you set your logs to TRACE level, you'll be able to see JSF skipping directly to RENDER_VIEW if that is in fact the case.
 
/dmc
 
On 7/3/06, Rob99 <[EMAIL PROTECTED]> wrote:

I'm adding an HtmlSelectOneMenu component programmatically like this

   HtmlSelectOneMenu menu = new HtmlSelectOneMenu();
   menu.setId("123");
   menu.setValueBinding("value", app.createValueBinding("#{MyBacking.x}"));
   menu.setConverter(new IntegerConverter());

Backing bean MyBacking has a member called "x" of type String and a
corresponding getter/setter.

       String x;

       public String getX()
       {
               logger.info("called getX");
               return x;
       }

       public void setX(String x)
       {
               logger.info("called setX");
               this.x = x;
       }

The getter gets called 1 time initially and JSF properly uses its value to
select the corresponding element of the dropdown (say "second").  So far so
good.  However the getter and setter never subsequently get called - even
when the page is submitted.

If I select another value in the dropdown (say "third") and click on some
other widgets which causes the page to redisplay, the new dropdown value
stays selected (still "third").  So JSF must be setting the dropdown
component's value.  But since the backing bean's getter/setter is never
subsequently called, when I ask the bean for the value of "x", it returns
the value initially set (which is "second").

What's going on?  There must be something basic going on here that I don't
understand.  Of course it makes sense for the getter to be called initailly
but why doesn't the getter or setter get called after that?  Any help would
be greatly appreciated.
--
View this message in context: http://www.nabble.com/Setter-not-called-for-value-binding-tf1887301.html#a5159953
Sent from the MyFaces - Users forum at Nabble.com.


Reply via email to