Getting request parameters in JSF

Here is the way, how we get request parameters from a JSP page (which is JSF enabled) in a HTTP request object.

import javax.faces.context.FacesContext;
//…your code
HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
String controlName = request.getParameter("formId:controlId");

Where formName is refer to the id of your form and controlId is referred to the id of your control.

Related Posts Plugin for WordPress, Blogger...

5 thoughts on “Getting request parameters in JSF

  1. Hi,
    and thank you very much!
    This works really fine! Just to mention, each control on the form is a container for inside controls; this means:
    if you have some checkboxes inside a table column, you’ll have to point to the first Checkbox as:
    form1:dataTable1:0:Select
    and so forth…

    Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *