I have a project in which I am using Pretty Faces for url rewriting. This is the pretty-config.xml.
<url-mapping parentId="level2" id="level3" >
<pattern value="/#{bean.urlLiv3 }">
</pattern>
<view-id value="/index.xhtml" />
<action>#{bean.loadLiv3}</action>
</url-mapping>
<url-mapping parentId="level2" id="level2" >
<pattern value="/#{bean.urlLiv2}">
</pattern>
<view-id value="/index.xhtml" />
<action>#{bean.loadLiv2}</action>
</url-mapping>
<url-mapping parentId="main" id="level1" >
<pattern value="#{ /.*-.*/ bean.urlLiv1 }" ></pattern>
<view-id value="/index.xhtml" />
<action>#{bean.loadLiv1}</action>
</url-mapping>
<url-mapping id="main">
<pattern value="/" />
<view-id value="/index.xhtml" />
<action>#{bean.loadLiv0}</action>
</url-mapping>
'''
It goes on up to level 5.
Without the regular expression /.*-.*/ on level 1 it works fine for every level, but when I add it I get an error when trying to navigate on levels 3, 4 and 5.
This is the error
Error parsing url: </urlliv1-8/urlliv2-43/urlliv3-20>, a parameter did not match compiled segment in pattern: /#{ /.*-.*/ bean.urlLiv1 }/#{bean.urlLiv2}/#{ bean.urlLiv3 }
Does anyone has an idea why I get this error? Thanks
sorry for the slightly confusing error message. This is likely due to the fact that you are using
.*in your regex patterns forurlLiv1.A major problem with
.*or.is that these patterns will match/characters. Try using something like this instead:[^/]*of the.matcher.