Page rendering problem with named parameters

Splash Forums PrettyFaces Users Page rendering problem with named parameters

This topic contains 6 replies, has 2 voices, and was last updated by  Christian Kaltepoth 8 years, 10 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #19763


    I am trying to use the named path parameters that are outlined in the prettyfaces documentation. The parameter gets passed to my page and the managed bean retrieves the value from the httprequest object. The issue is that the page rendering goes to hell. It looks like the context gets all messed up. All the links on the page are appending the url to the existing url. The css files are not loaded appropriately. The page renders fine when I don’t use named parameter. Is there something specific that I need to do to get this working correctly? I checked the logs and there are no errors in the tomcat logs.

    This is my configuration for the url:

    <url-mapping id=”admin-agent-profile”>

    <pattern value=”/admin-agent-profile/#{ id }” />

    <view-id value=”/admin/AgentProfile.xhtml” />


    I am using Tomcat 7, JSF 2, Primefaces 3.4, Primefaces Extensions, and Prettyfaces 3.3.3.

    Thanks. Jim.


    Do you have any other configuration in your pretty-config.xml? Could you please give an example for “All the links on the page are appending the url to the existing url”? And what do you mean with “The css files are not loaded appropriately”? Do the requests result in a 404?

    I never heard of something like this before. And it only happens for named path parameters? Not for EL ones? You could try to rename the named path parameter to “agentId” or something like this. Perhaps there is some kind of conflict regarding the name “id”.


    Hmmm…. i do have another config item in the xml that has the same named parameter, but i changed this one to agentId and it still didn’t work.

    The links appending issue is like this — if a url is something like manage-agents for a link. It becomes localhost/context/admin-agent-profile/manage-agents instead of localhost/context/manage-agents.

    The css issue is that none of the css rules are being applied. The web page layout is completely destroyed. This tells me the files are not being parsed.

    I will check for 404 errors tomorrow morning when I get in the office to see if there is an error with the files loading. This is a super strange issue. Like a said before every other page renders fine that doesn’t have named parameter.


    Ok, please let me know if the CSS files don’t load correctly because of a 404 or something else. This could give a clue what is going on in your app.

    Could you perhaps also post your complete web.xml and pretty-config.xml?


    Looks like there are 404 errors. The same thing that is happening to the links on the page are happening to the css file references.

    The url for the css file is coming up as http://localhost:8084/Agents/admin-agent-profile/css/default.css

    The admin-agent-profile part of the link is the url mapping in the prettyfaces config. It shouldn’t be in the url of the css file.

    The snippet for my css file in the facelets template page is like this:

    <link href="css/default.css" rel="stylesheet" media="screen" type="text/css" />

    Again, this has worked up till now with the named parameter.


    <web-app version="3.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-name>Faces Servlet</servlet-name>



    I went back to my templates and changed the urls for the css files and all links to include this prefixed:


    My guess is that there is some kind of internal processing with the urls that contain parameters that alters any existing url paths. I guess that processing doesn’t occur when it is a straight redirect. This change fixes my problem, but I wish I had the real reason why the urls broke with the named parameters. For my own knowledge and insight. I think it is more of my ignorance on understanding the mechanics of prettyfaces.


    I think the reason that your CSS files didn’t load is caused by the fact that you are using relative paths for loading the css:

    <link href="css/default.css" rel="stylesheet" media="screen" type="text/css" />

    For the browser this means that the file has to be downloaded relative to the “current directory”. With your mapping, If you request an URL like this:


    The “current directory” is:


    So the browser will request:


    Which won’t work of cause. Therefore you should always use absolute paths like this:

    <link href="#{request.contextPath}/css/default.css" rel="stylesheet" media="screen" type="text/css" />

    I hope this clears up the situation. :)

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

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

Comments are closed.