6 Replies Latest reply on Jan 29, 2013 10:15 AM by 968650

    Get parameter from URL in Java code

      Hello everyone,

      I've got strange problem. I have one JSF page with two controls:
      - InputText
      - Button

      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <af:document title="view12.jsf" id="d1">
      <af:messages id="m1"/>
      <af:form id="f1">

      <af:inputText label="Label 1" id="it98" value="#{param.test}" editable="always"/>
      <af:commandButton actionListener="#{bindings.przekierowanie.execute}" text="przekierowanie"
      disabled="#{!bindings.przekierowanie.enabled}" id="cb1"/>

      And I want to initialize the InputText with parameter from URL (param name is test - value="#{param.test}"). In JSF page everything is fine. But after clicking button I have to read the value from InputText in Java Code, so I have URL:

      and my Java code which is executed after clicking button is:

      public String przekierowanie() {
      Map <String,String> map=FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
      String tttValue=map.get("test");
      System.err.println("test:" + tttValue);
           return null;

      but this doesn't work... Everytime I get null when I click the button. Could you tell me why and How to obtain this value, from InputTex in my java function?