Re: Generate pretty link inside java code

Splash Forums PrettyFaces Users Generate pretty link inside java code Re: Generate pretty link inside java code

#21567

Hey m1m,

please don’t change your question by editing your old one because people may get confused by this. Just post a reply to clarify your question.

Regarding your question. Yes, you can create URLs in Java code. There is a class called PrettyURLBuilder that can be used. See this example:

PrettyConfig config = PrettyContext.getCurrentInstance().getConfig();
UrlMapping mapping = config.getMappingById("myMapping");
PrettyURLBuilder builder = new PrettyURLBuilder();
String url = builder.build(mapping, true, new Object[] { "somePathParameter "});

I hope this helps! :)