Reply To: Need help with Navigation

Splash Forums PrettyFaces Users Need help with Navigation Reply To: Need help with Navigation

#26647

Your URL patterns overlap. That’s not a good idea:


    <url-mapping parentId="home" id="viewCategory">
        <pattern value="/#{ category : categoryBean.categoryName }"/>
        <view-id value="/faces/somethingList.xhtml"/>
    </url-mapping>
    
    <url-mapping  parentId="viewCategory" id="viewProduct">
        <pattern value="/#{ product : productBean.id }/"/>
        <view-id value="/faces/product.xhtml"/>
    </url-mapping>

For an incoming request like /foobar, how should PrettyFaces know which of the two mappings to use? Currently PrettyFaces will always choose the first one. You should change both by adding a prefix. Something like:


    <url-mapping parentId="home" id="viewCategory">
        <pattern value="/category/#{ category : categoryBean.categoryName }"/>
        <view-id value="/faces/somethingList.xhtml"/>
    </url-mapping>
    
    <url-mapping  parentId="viewCategory" id="viewProduct">
        <pattern value="/product/#{ product : productBean.id }/"/>
        <view-id value="/faces/product.xhtml"/>
    </url-mapping>