myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Robinson" <>
Subject Re: JSF can handle GET requests *just as easily* as other frameworks
Date Fri, 14 Apr 2006 20:40:16 GMT
The large difference I saw with using get requests for JSF and using
the "InvokingJsfPagesWithStandardUrls" is the fact that the WIKI
example actually executes an action. If you don't want an action to
execute, then there is no reason to have to do anything special for a
GET request. In fact, if you use my onload component from jsf-comp,
you can have an action executed on load of a page using a GET request
without any special servlet.

With Seam in fact, there is a @RequestParameter annotation that will
help with this, automatically injecting a request parameter string
value into a string member variable in a backing-bean. Then, to
support both GET and POST operations, you can use a parameter on your

  <f:param name="documentId" value="#{mybean.documentid}" />

then, in your bean, have:

public class MyBean {
  private String documentid;

  public String onload()
    // load your document here from the ID

Then in your onload-config.xml, have #{mybean.onload} fired when you
page that needs the document is loaded.


On 4/14/06, Adam Winer <> wrote:
> Adam,
> That's solved straightforwardly with indirection,  so that
> you have, say, a DocumentProviderBean with get/setId() and
> getDocument() on it, and getDocument() has the code to handle
> converting the ID into an appropriate object - presumably with a
> trivial call to your DAO layer.  The request parameter goes
> to the DocumentProviderBean, and your page gets the document
> out of the document provider.
> Do other frameworks make this pattern significantly simpler?
> If so, how?
> -- Adam
> On 4/14/06, Adam Brod <> wrote:
> >
> > Hey Adam-
> >
> > The most common type of GET requests I've had trouble with in JSF is binding
> > request parameters to complex managed bean parameters.
> >
> > For (a simple) example, say I have a link
> > /faces/vewDocument.xhtml?documentID=1234.
> > viewDocument.xhtml has a backing bean ("documentController") with a managed
> > property named "documentID" and value "#{params.documentID}".
> > DocumentController.setDocumentID() takes a
> > DocumentIdentifier object, not a primitive.
> >
> > Can JSF convert the request parameter to an object even though the request
> > goes directly to the render phase?  Will a Converter work or will JSF
> > auto-wire this since it can see that the target setDocumentID(...) method
> > takes a parameter of type DocumentIdentifier?
> >
> > Thanks for your input.
> >
> >  Adam Brod
> >  Product Development Team
> >

View raw message