How can handle URL ?

Splash Forums PrettyFaces Users How can handle URL ?

This topic contains 40 replies, has 3 voices, and was last updated by  thanhtung90 10 years, 3 months ago.

Viewing 15 posts - 1 through 15 (of 41 total)
  • Author
  • #18026


    Dear everybody, when i create url by set <pattern> value like this:


    and then check in danhMucController, “category”‘s but seem nothing. And:


    it fine, but how can get url with?


    Your first pattern will probably not match because path parameters don’t match / in the default configuration and you are missing the leading slash as the first part of the URL. Try:


    You second pattern is missing the name of the property to inject the value into. You need to write something like:

    <pattern>/#{ /[a-z-_:]+/ danhMucController.category }/</pattern>

    See the documentation for details:



    Uhm, i tried, but current still null when i access in both cases:

    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    String menu = externalContext.getRequestParameterMap().get("category");

    and similar with:

    <pattern>/#{ /[a-z-_:]+/ category }/</pattern>

    But fail, too.


    Does the pattern really match? Is the view rendered that you referenced in your mapping?



    Actual, i don’t understand your mind(sorry because my english not good). I’m try with


    In my config, i choice like your suggest and like above, here:

    <pattern>/#{ /[a-z-_:]+/ category }/</pattern>

    Navigator() method return String which dynamic url i want redirect to: “pretty:home”.

    For homepage, my pattern here:

    <url-mapping id="home">
    <pattern value="/"/>
    <url-mapping id="register">
    <pattern value="/re-gis-ter.html"/>

    and these fine, for few other with fix .xhtml pages – it’t ok, too.


    Ah, OK, you are using dynaview! Perhaps this is related to this issue:

    Seems like the same issue, right?



    In this example, my app infinity loop:

    #{ /.*/ parameters : navigationBean.parameters}

    And other, I see nothing special with my cases.

    Hmm, strange. It really shouldn't happen that way. Do you think you could create a little example app that shows this? I'm very surprised by this actually, because this is how the code looks in PrettyPhaseListener:

    if (!event.getFacesContext().getResponseComplete())
    // run parameter validation

    // abort if validation failed, 404 response code has already been set
    if (event.getFacesContext().getResponseComplete())

    // inject parameters

    PrettyContext prettyContext = PrettyContext.getCurrentInstance(event.getFacesContext());
    if (prettyContext.shouldProcessDynaview())
    dynaview.processDynaView(prettyContext, event.getFacesContext());

    This maybe need i extends or implements PrettyPhaseListener?


    1. Regarding the infinity loop. Could you post the complete mapping please?

    2. I don’t think you can fix this issue by extending PrettyPhaseListener. IMHO the if statement (first line in your quote) is the problem. You could try to remove the if but this would require you to clone the PrettyFaces source and compile it yourself. I hope to find some time on the weekend to work in this issue. Perhaps I will find the real cause of this then.



    1. Here,

    The server side component of the HTTP Monitor has detected a java.lang.StackOverflowError.
    This happens when there is an infinite loop in the web module.
    Correct the cause of the infinite loop before running the web module again.

    and pattern that i use in problem:

    #{ /.*/ parameters : navigationBean.parameters}

    2. I just suggest about that link you gave because in pattern that you gave (both 2 cases):

    <pattern>/#{ /[a-z-_:]+/ danhMucController.category }/</pattern>


    <pattern>/#{ /[a-z-_:]+/ category : danhMucController.category }/</pattern>

    nothing i received (null value).


    Hey there.

    could you please post the complete <url-mapping> that is causing the stack overflow? And perhaps the stacktrace. This would be really helpful for finding the cause of this issue.

    I did some research on the problem regarding the path parameters that are not injected when using dynaview. I think I found the bug causing this and just pushed a fix to the main repository. Could you perhaps give the latest snapshots (3.3.1-SNAPSHOT) a try? You can find all required details on how to use the snapshots here:





    This is my code:

    <url-mapping id="catalog" >
    <!-- <pattern>/#{category : /[a-z-_:]+/}/</pattern>-->
    <!-- <pattern value="/category/"/>-->
    <pattern>/#{ /[a-z-_:]+/ category : danhMucController.category }/</pattern>
    <!-- <pattern>#{/.*/ category: danhMucController.category}</pattern>-->
    <!-- <action>#{phimController.navigator}</action>-->

    But how i can use this version Snapshots? I’m a newbie. Thank.



    I download Snapshots version but nothing change with

    <pattern>#{/.*/ category: danhMucController.category}</pattern>

    i still receive error above.


    The fix that I wrote about (and which is now available in 3.3.1-SNAPSHOT) fixes the issues you described in your second post on this thread. You wrote that the category parameter was always null when using dynaview. This issue should be fixed now. So please try something like this:

    <url-mapping id="catalog">
    <pattern>/#{ danhMucController.category }/</pattern>
    <view-id>#{ danhMucController.navigator }</view-id>


    public class DanhMucController {

    private String category;

    public String navigator() {
    System.out.println("Category: "+category);
    return "/faces/myview.xhtml";


    The stack overflow error seems to be a totally different issue. We will definitively need the stacktrace to help you there.



    Actual i don’t understand, i follow your tutorial, even i copy because i fear confuse by myself, but current with Snapshots “prettyfaces-jsf2-3.3.1-20110919.063144-23-sources.jar” combine 2 codes above i still got result null. No warning, no error.

    This is my web.xml:

    <filter-name>Pretty Filter</filter-name>

    <filter-name>Pretty Filter</filter-name>


    I don’t know whats wrong with your code. Could you perhaps build a small example app reproducing this issue? You could use my Maven archetypes to set up a small PrettyFaces project quickly.

Viewing 15 posts - 1 through 15 (of 41 total)

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

Comments are closed.