This discussion is archived
6 Replies Latest reply: Jan 29, 2013 2:15 AM by 968650 RSS

Get parameter from URL in Java code

968650 Newbie
Currently Being Moderated
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" "">
<f:view xmlns:f="" xmlns:af="">
<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?


  • Correct Answers - 10 points
  • Helpful Answers - 5 points