myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Brod <AB...@intralinks.com>
Subject Re: JSF can handle GET requests *just as easily* as other frameworks
Date Fri, 14 Apr 2006 20:56:49 GMT
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" <awiner@gmail.com> 
04/14/2006 04:23 PM
Please respond to
"MyFaces Discussion" <users@myfaces.apache.org>


To
"MyFaces Discussion" <users@myfaces.apache.org>
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 <ABrod@intralinks.com> 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
>


Mime
View raw message