On Tue, 23 Nov 2004 13:45:37 -0500, Rick Reumann <[EMAIL PROTECTED]> wrote:
> First off, Craig if you are reading this, how come no one has started a
> jsf-users mailing list? I hate using web forums. yuk:) Seems like

I'm not a huge fan of web forums either, but that's what JSF has to
deal with :-).

  (Free registration required) http://forum.java.sun.com/forum.jspa?forumID=427


> 
> First, let me frame my question in light of real life terms that we have
> to deal with. We have some complex nested value objects that return from
> the backend. Typically the user on the front end is provided the
> opportunity to modify just a few of the nested VO properties. The nested
> VOs are thus stored in Session scope which makes it very easy to return
> back the full VOs with the modified properties (after BeanUtils does the
> copying of the request params). For those that are wondering why not
> just create an ActionForm to capture the single properties you need, the
> answer is this would be a nightmare to then figure out how to get those
> properties from your from back into the correct spots in the different
> ValueObjects. (By the way, I don't think the backend should need to
> provide ways to handle how the front is giving you the data so the
> backend 'should' be able to just give me a VO with nested VOs inside).
> All of this works completely fine in a Struts environment and is made
> really easy by the use of the nested tag. (Validation is handled on the
> backend).
> 
> My question then becomes... will JSF be able to handle nested objects
> just as easily? I'm assuming it should but I haven't explored any of the
> JSF tags. I'm assuming that at the very least I could do like I would do
> it with JSTL and Strtus (not using the Nested tag) and be able to write
> a JSF input maybe like:
> 
> <h:inputText
> value="#{someVo.someList[${someHandleToAnIndexInLoop}].someList[${someHandleToAnIndexInLoop}].someList[${someHandleToAnIndexInLoop}].someValue}"/>
> 
> Of course it would ne nicer with an nested tag equivalent, but the above
> will work. Just checking to make sure JSF can deal with this in some way
> before I get started. If not, I'm really stuck not being able to use
> JSF, since our business requirements are complex and the objects coming
> from the backend will be nested and I need to return them back to the
> backend in their modified form. (I also don't want to have to hardcode a
> bunch of hidden variable place holders so that's why I'm using Session
> to store the VOs).
> 
> Thanks for any light on this issue.
> 

JSF can indeed deal with nested expressions for its value bindings
("#{foo.bar.baz}), but you won't be able to intermix JSF expressions
"#{...}" and JSP expressions "${...}" because the JSF tags all turn
off evaluation of runtime expressions (to avoid potential cross site
scripting like attacks).

So, something like this should work:

<h:inputText
value="#{someVo.someList[someHandleToAnIndexInLoop].someList[someHandleToAnIndexInLoop].someList[someHandleToAnIndexInLoop].someValue"/>

Note that JSF basically does away with the need for a form bean
because the components themselves do what we use form beans for
(holding the string version of the input data so it can be redisplayed
if conversion fails).

> --
> Rick

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to