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...

Related Posts

Tags:

  • Mohammad M. Saffari

    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!

  • http://essamabdelaziz.wordpress.com essamabdelaziz

    Dear,
    thanks for this nice blog please keep on

    actullay i’m anewbie in jsf

    i want asample code to datatable which can add,delete,update and edit

    could you please send me this one

    my mail

    eng_essamzizo@hotmail.com

    Thanks

  • http://www.ofermisk.com/articles Ofer

    Thanks ,
    Thumbs up.

  • http://ocpsoft.com/prettyfaces james c

    You can also try PrettyFaces — bookmarkable pages and also lets you call actions when pages are accessed via GET (http://ocpsoft.com/prettyfaces)

  • Anonymous

    thank you very much!! You saved our school-project =)

Switch to our mobile site