Generate pretty link inside java code

Splash Forums PrettyFaces Users Generate pretty link inside java code

This topic contains 3 replies, has 2 voices, and was last updated by  Christian Kaltepoth 10 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #18057

    m1m
    Participant

    Hi

    Is it possible to generate pretty link with path parameters inside java code (not on jsf page)?

    #21565
    #21566

    m1m
    Participant

    But I want use it in backing bean.

    #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! :)

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.