Re: How to avoid junk character in URL?

Splash Forums PrettyFaces Users How to avoid junk character in URL? Re: How to avoid junk character in URL?

#23045

PrettyFaces 3.x doesn’t support conversion of path parameters. That’s something you get with Rewrite / PrettyFaces 4.0.

Currently you could simply use special getters and setters. Something like:

<url-mapping id=3D"hotelreview">
<pattern value=3D"/hotel-detail/#{hotelSearchResultsBean.prettyHotelName}/#{hotelSearchResultsBean.prettyCityName}" />
<view-id value=3D"/pages/hotel/hotelReview.xhtml" />
</url-mapping>

And the bean:

public class HotelSearchResultsBean {

private String hotelName;

/* regular getters / setters */

public String getPrettyHotelName() {
return hotelName.replace(' ', '-');
}

public void setPrettyHotelName(String str) {
this.hotelName = str.replace('-', ' ');
}

}

But please not that this will of cause break if you have both – and space characters in your strings.