Adam-

I don't think your response is quite what I was getting at.  In Struts world, I have lots of ugly code sprinkled everywhere that converts request params to very low-level custom objects in our system (for example, Enums for statuses, types, and flags as well as other objects like Identifiers, Credit Card Numbers, EmailAddresses, etc.),  When using JSF post-backs, we can use Converters to handle all that boiler-plate request param -> object mapping.  If using JSF with GET requests, we cannot use converters, can we?  

If my understanding is correct, that is a definitely limitation of using GET with JSF.

Adam Brod

Product Development Team




"Adam Winer" <[EMAIL PROTECTED]>

04/14/2006 04:23 PM

Please respond to
"MyFaces Discussion" <[email protected]>

To
"MyFaces Discussion" <[email protected]>
cc
Subject
Re: JSF can handle GET requests *just as easily* as other frameworks





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 <[EMAIL PROTECTED]> 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
>

Reply via email to