Retrieve input value from JSF page

I am trying to retrive input text of the textboxes from a jsf page but nothing returns. what is wrong with the code?

<h:form id="myForm">
<h:inputText size="10" id="txtName"/>

    public void printValue() {
        HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
        String txtName = request.getParameter("myForm:txtName");
        System.out.println(txtName);
    }

ayha
LVL 7
ayha1999Asked:
Who is Participating?
 
Mark BullockQA Engineer IIICommented:
In the inputText tag, add  value="#{your_class_name.userInput}

Use the @ManagedBean annotation on your class.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.