You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rafael Nami <ra...@gmail.com> on 2005/08/29 20:34:45 UTC

[Struts] - How to put a nested object inside a set, that's inside a ActionForm

Hi everyone

I'm trying to build a search, accessing a nested object, in a JSP,
that is inside a set nested in the a POJO, to perform a search in the
page.

For example, I have a 
PersonForm p -> Set purchases -> Product product -> Brand brand -> brand name

I was trying this approach:
<td align="left">
   <appfuse:label key="personForm.purchases.product.brand.name"/>
</td>                              
<td align="left">
    <html:text property="purchases.product.brand.name" size="15"/>
     (full or partial)
</td>

How can I do it?

Best Regards

Rafael Mauricio Nami

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [Struts] - How to put a nested object inside a set, that's inside a ActionForm

Posted by Rafael Nami <ra...@gmail.com>.
I've done this:
Added to PersonForm a brandName - now I just have to get the Hibernate
CriteriaQuery running.

Thanks Laurie

Rafael Mauricio Nami


2005/8/29, Laurie Harper <la...@holoweb.net>:
> Rafael Nami wrote:
> > I'm trying to build a search, accessing a nested object, in a JSP,
> > that is inside a set nested in the a POJO, to perform a search in the
> > page.
> >
> > For example, I have a
> > PersonForm p -> Set purchases -> Product product -> Brand brand -> brand name
> >
> > I was trying this approach:
> > [...]
> >     <html:text property="purchases.product.brand.name" size="15"/>
> > [...]
> > How can I do it?
> 
> The short answer is, you can't: there's no way to access members of a set
> directly like this. You'll need to change your form bean to store your
> purchases as an indexed property so you can address them with something like
> 
>      <html:text property="purchases[0].product.brand.name" size="15"/>
> 
> L.
> --
> Laurie Harper
> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> Founder, Zotech Software: http://www.zotechsoftware.com/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
Java - Assim no Server como no Palm
<i>Java - thus in the Server as it is in Palm

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [Struts] - How to put a nested object inside a set, that's inside a ActionForm

Posted by Laurie Harper <la...@holoweb.net>.
Rafael Nami wrote:
> I'm trying to build a search, accessing a nested object, in a JSP,
> that is inside a set nested in the a POJO, to perform a search in the
> page.
> 
> For example, I have a 
> PersonForm p -> Set purchases -> Product product -> Brand brand -> brand name
> 
> I was trying this approach:
> [...]
>     <html:text property="purchases.product.brand.name" size="15"/>
> [...]
> How can I do it?

The short answer is, you can't: there's no way to access members of a set 
directly like this. You'll need to change your form bean to store your 
purchases as an indexed property so you can address them with something like

     <html:text property="purchases[0].product.brand.name" size="15"/>

L.
-- 
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org