2

I have a JSF2 web application that i would like to receive some parameters from another web application.

Another application to redirect user to my JSF2 application using URL:
http://something.com/myjsf2app/getCallback.jsf?item=apple&color=green

I would like to know what i need to do to retrieve the following two values (item, color) in my backing bean without needing to hit on submit on getCallback.jsf.

Oh Chin Boon
  • 21,393
  • 45
  • 133
  • 208

1 Answers1

2

you could use viewparams to set the parameters in a @ViewScoped @ManagedBean

<h:body>
    <f:metadata>
        <f:viewParam id="item" name="item" value="#{myBean.item}"/>
        <f:event type="preRenderView" listener="#{myBean.init}" />
    </f:metadata>
</h:body>

The view param is set after your beans @PostConstruct method is invoked. So if you want to do some stuff based on the value, use the event preRenderView

Aksel Willgert
  • 10,807
  • 5
  • 48
  • 70
  • Related: http://stackoverflow.com/questions/6377798/what-can-fmetadata-and-fviewparam-be-used-for/6377957#6377957 – BalusC Jun 21 '13 at 12:38