Yes, the code below would work just fine if you initialize the Cart
object somewhere (such as the perform() method).

Jeff Schnitzer
[EMAIL PROTECTED]

> -----Original Message-----
> From: Philip M. Meier [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, August 25, 2002 12:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [Mav-user] Domify and XML-Nodes!
> 
> Hi Jeff,
> 
> when I try your example-code I have a problem. What does the getCart-
> method
> has to return? An instance of the Cart-class, which is declared like
the
> following?
> 
> public class HelloWorld extends ThrowawayBean2 {
> 
>  private Cart cart;
> 
>  public Cart getCart() {
>   return cart;
>  }
> 
>  class Cart {
> 
>   public String getItems() {
>    return "test";
>   }
> 
>   public String getTotal() {
>    return "test";
>   }
> 
>  }
> 
> }
> 
> > To get something like that, you would want getCart() to return an
object
> > which had methods getItems() and getTotal().  For example:
> >
> > public class YourModel
> > {
> >    public Cart getCart()  { ... }
> > }
> >
> > public class Cart
> > {
> >     public int getItems()  { ... }
> >     public float getTotal()  { ... }
> > }
> >
> > Alternatively, you could have getCart() return a Map, but that would
> produce
> > XML which looked like this:
> >
> > <Cart>
> >   <item key="items">0</item>
> >   <item key="total">0.0</item>
> > <Cart>
> >
> > Does that answer your question?
> >
> > Jeff Schnitzer
> > [EMAIL PROTECTED]
> 
> Thanks,
> Phil
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
> http://finance.yahoo.com
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by: OSDN - Tired of that same old
> cell phone?  Get a new here for FREE!
> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> _______________________________________________
> Mav-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/mav-user
> Archives are available at http://www.mail-archive.com/


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Mav-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mav-user
Archives are available at http://www.mail-archive.com/

Reply via email to