myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leyzerzon, Simeon" <simeon.leyzer...@credit-suisse.com>
Subject RE: HtmlSelectOneMenu valueChange behavior
Date Mon, 11 Sep 2006 16:28:25 GMT
Sorry, I meant to say that calling this.getReportName() in the buidControl() listener returns
null whereas event.getNewValue() works.
Simeon

  _____  

From: Leyzerzon, Simeon [mailto:simeon.leyzerzon@credit-suisse.com] 
Sent: Monday, September 11, 2006 12:21 PM
To: 'users@myfaces.apache.org'
Subject: HtmlSelectOneMenu valueChange behavior



Hi, 
I have the following code in my application, and it works, but I'm wondering if this is the
right way to do it: 

public HtmlPanelGrid getPanelGrid() { 
        
        grid = new HtmlPanelGrid(); 
        grid.setColumns(4); 
        grid.setBgcolor("red"); 

        HtmlSelectOneMenu chooser = new HtmlSelectOneMenu(); 
        chooser.setId("reportsOfCategory"); 
        chooser.setOnchange("submit()"); 
        chooser.setValue("${selector.reportName}"); 
        chooser.setValueChangeListener(application.createMethodBinding( 
                "#{selector.buildControls}", 
                new Class[] { ValueChangeEvent.class})); 
        chooser.setTitle("Please select a report to run"); 
        chooser.getChildren().add(ReportsPerCategoryMapper.getOptionItems(this.getCategory().getName()));

        
        grid.getChildren().add(chooser); 
        //this is only for testing 
        grid.getChildren().add(displayCategory()); 
        return grid; 
    } 
    
    public void buildControls(ValueChangeEvent event) { 
        System.out.println("I got the report's name: " + event.getNewValue()); 
    } 


Calling chooser.getValue() in the listener method returns null, whereas event.getNewValue()
works.  Could someone please explan this behavior.  What is the purpose of chooser.setValue()
if getting the value doesn't work?  Would it be correct to do:

                reportName = event.getNewValue(); 

or is there a better way? 

TIA. 

Simeon Leyzerzon 
Risk IT 
 <http://www.credit-suisse.com/> <<...OLE_Obj...>> 
      
Tel: 212-538-7518 
Profile < <http://people.csfb.net/from_gtd.asp?gtdid=1160763> http://people.csfb.net/from_gtd.asp?gtdid=1160763>




==============================================================================

Please access the attached hyperlink for an important electronic communications disclaimer:




http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html

==============================================================================


==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:


http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================

Mime
View raw message