Reply To: Navigation using path parameter on Pretty Faces 2.0.8.Final

Splash Forums PrettyFaces Users Navigation using path parameter on Pretty Faces 2.0.8.Final Reply To: Navigation using path parameter on Pretty Faces 2.0.8.Final

#25822

Hey Daniel,

I just had a look at your sample project. The problem is that you have two mapping for /pages/Second.xhtml:

@URLMappings(mappings = {
  @URLMapping(id = "secondCreate", pattern = "/second", viewId = "/pages/Second.xhtml"),
  @URLMapping(id = "secondUpdate", pattern = "/second/#{id : second.id}", viewId = "/pages/Second.xhtml")
})

Now if you return something like this:

return "/pages/Second.xhtml?faces-redirect=true&id=" + id;

PrettyFaces basically search for a mapping with a matching view id. In your case the first mapping which such a view id is secondCreate. And as there is no id parameter in this parameter, it is added as a query parameter.

To work around that you could use a PrettyFaces navigation string like this:

this.id = 1;
return "pretty:secondUpdate";

This way you can tell PrettyFaces exactly which mapping to use for the redirect. With such an navigation outcome will extract the values directly from your bean properties to build the URL. So it is important to set the ID correctly.

I hope this helps.

Christian