Passing a query-param by annotation

Splash Forums PrettyFaces Users Passing a query-param by annotation

This topic contains 7 replies, has 3 voices, and was last updated by  Lincoln Baxter III 9 years, 9 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #18258

    Tony Herstell

    I am adding this to a controller (to reduce the amount of stuff in pretty-config.xml)

    @URLMapping(id = "error", pattern = "/error", viewId ="/pages/error/generalError.xhtml")

    and came unstuck as the “rule” was:

    <url-mapping id="error">
    <pattern value="/error"></pattern>
    <query-param name="exception">#{exception}</query-param>
    <view-id value="/pages/error/generalError.xhtml"/>

    How do I pass the query-param?

    I tired

    pattern = "/error?#{exception}",

    and other combinations…


    If you are using annotations to configure PrettyFaces you can annotate a field with @URLQueryParameter. In this case the value of the query parameter will be automatically injected into the corresponding bean property.



    Tony Herstell

    Hi Christian,

    The message is being stuffed, by the JSF Exception handler override class I had to provide, into the request map so the “error” page can access it through el…

    In Exception Override bean:

    Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
    requestMap.put("exception", messageToReturn);

    On error page:

    <div class="error">
    <h:outputText escape="false" value="#{exception}" />

    I do pass “params” elsewhere

    private String cid;

    but this is an odd case…


    Yeah, this is something that the annotation configuration is not really good for. My recommendation would be to bind that property to a bean, like a regular query parameter, then access that parameter from your page.


    Sorry, access the value in the bean from your page.


    Tony Herstell

    Tony Herstell

    Sorry; removed post.

    I though I have solved it.. but alas no….


    Not sure what the problem you are having is, actually.

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

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

Comments are closed.