Path parameters are null in the managed bean when view id is dynamic.

Splash Forums PrettyFaces Users Path parameters are null in the managed bean when view id is dynamic.

This topic contains 3 replies, has 3 voices, and was last updated by  Christian Kaltepoth 9 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #18375


    In a web application I am using Prettyfaces version 3.1.0, Weblogic server 11g and Jsf 2.0

    I have the following code in : pretty-config.xml

    <url-mapping id="property1">
    <pattern value="hotels/#{propertyName1 : searchCriteria.propertyName1}/hotel-overview"/>
    <query-param name="hotel_id">#{searchCriteria.hotelId}</query-param>
    <query-param name="checkin_date" validatorIds="checkInCustomValidation checkInOutCustomValidation" onError="pretty:home">#{searchCriteria.strcheckInDate}</query-param>
    <query-param name="checkout_date" validatorIds="checkOutCustomValidation checkInOutCustomValidation" onError="pretty:home">#{searchCriteria.strcheckOutDate}</query-param>
    <action onPostback="false">#{propertyBean.propertyDetails}</action>

    In this case the path parameter (i.e propertyName1) are coming as null in the managed bean: The code is as follows:

    FacesContext facesContext = FacesContext.getCurrentInstance();
    if (facesContext != null) {
    reqParamMap = facesContext.getExternalContext().getRequestParameterMap();
    System.out.println("Request Parameter Map : "+reqParamMap);
    propName = reqParamMap.get("propertyName1");

    However the the same parameter is not null and I am getting the value as entered in the url when the view id is not dynamic i.e if the view id is as follows :


    I do not have any clue about this! I need to get the path parameters for dynamic view id.

    Thanking you in anticipation of your quick response


    You are using a very old version of PrettyFaces. There have been some bugfixes reading dynaview in the last versions. Could you please update to 3.3.3 and check if this solves your problem.



    The Latest version 3.3.3 doesn’t solve the problem. Infact i have tried to capture the path parameters from PrettyContext and that has solved the problem.

    See if it helps.

    * This method returns the value of path parameter values form pretty context
    * @param prettyContext
    * @param searchTerm
    * @return
    public static String findPathParameterValue(PrettyContext prettyContext, String pathParam){

    Map<String, String> parameterMap = new HashMap<String, String>();
    String paramValue = "";
    String keyUrl = prettyContext.getCurrentMapping().getPattern();
    String valueUrl = prettyContext.getRequestURL().toString();
    String [] keyArray = keyUrl.split("/");
    String [] valueArray = valueUrl.split("/");

    for(int index = 0; index < keyArray.length; index++){
    parameterMap.put(keyArray[index], valueArray[index]);

    for (Map.Entry<String, String> entry : parameterMap.entrySet()){
    paramValue = entry.getValue();

    return paramValue;


    Hmmm. I think the problem in your case is that the forwarded request (which is determined using dynaview) is treated as a completely new request which isn’t related to the original one any more. Therefore path parameters only work in the forwarded URL.

    I think you will really need some custom code here. :(

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.