List Info

Thread: h:selectOneMenu - two different methods will be called




h:selectOneMenu - two different methods will be called
country flaguser name
United Kingdom
2007-10-05 07:38:38
Hi,

I created a selectOneMenu with an valueChangeListener. After
choosing 
another value in the menu a
Method is called which links to website. It all works fine,
but then I 
added another selectOneMenu
with another valueChangeListener method.
If I choose a value in one of the menus both
valueChangeListener methods 
will be called
and I don't know why?!


xhtml:
------------------------------------------------------------
-------------------------------------------------------
            <h:selectOneMenu id="itemPosPicr"
                            
rendered="#{currentData.renderedPicrPos}"
                             onchange="submit()"
                             
valueChangeListener="#{statisticsPageData.processValueC
hangePicrPosResult}">
                <f:selectItems
value="#{currentData.itemPosPicr}"/>
            </h:selectOneMenu>

            <br></br>

            <h:outputText value="Proteins could not
mapped to UniProt:"/>
            <h:selectOneMenu id="itemNegPicr"
                            
rendered="#{currentData.renderedPicrNeg}">
                 <f:selectItems
value="#{currentData.itemNegPicr}"/>
            </h:selectOneMenu>



            <h:outputText value="Proteins identified
in Pride:"/>
            <h:selectOneMenu id="itemPosPride"
                            
rendered="#{currentData.renderedPridePos}"
                             onchange="submit()"
                             
valueChangeListener="#{statisticsPageData.processValueC
hangePridePosResult}">
                <f:selectItems
value="#{currentData.itemPosPride}"/>
            </h:selectOneMenu>

            <br></br>

            <h:outputText value="Proteins not
identified in Pride:"/>
            <h:selectOneMenu id="itemNegPride"
                            
rendered="#{currentData.renderedPrideNeg}">
                 <f:selectItems
value="#{currentData.itemNegPride}"/>
            </h:selectOneMenu>



Bean:
------------------------------------------------------------
---------------------------------------
public void processValueChangePicrPosResult(ValueChangeEvent
value) 
throws AbortProcessingException, IOException {

        String selectedValue = (String)
value.getNewValue();
        String uniProt_Url = 
"htt
p://beta.uniprot.org/uniprot/?query=key:" +
selectedValue;
        
FacesContext.getCurrentInstance().getExternalContext().redir
ect(uniProt_Url);
 }

public void
processValueChangePridePosResult(ValueChangeEvent value) 
throws AbortProcessingException, IOException {

        String selectedValue = (String)
value.getNewValue();
        String uniProt_Url = 
"htt
p://beta.uniprot.org/uniprot/?query=key:" +
selectedValue;
        
FacesContext.getCurrentInstance().getExternalContext().redir
ect(uniProt_Url);
  }


Any hints or suggestions?

Cheers!

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )