You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Wolfgang <wk...@ebi.ac.uk> on 2007/10/05 14:38:38 UTC
h:selectOneMenu - two different methods will be called
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.processValueChangePicrPosResult}">
<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.processValueChangePridePosResult}">
<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 =
"http://beta.uniprot.org/uniprot/?query=key:" + selectedValue;
FacesContext.getCurrentInstance().getExternalContext().redirect(uniProt_Url);
}
public void processValueChangePridePosResult(ValueChangeEvent value)
throws AbortProcessingException, IOException {
String selectedValue = (String) value.getNewValue();
String uniProt_Url =
"http://beta.uniprot.org/uniprot/?query=key:" + selectedValue;
FacesContext.getCurrentInstance().getExternalContext().redirect(uniProt_Url);
}
Any hints or suggestions?
Cheers!