I hope this helps.

        // the classloader will use the classpath to find the mapping file
        // it can be in a jar file or a war file
        String mappingFile = "/myapp/mapping.xml";
        Mapping mapping = new Mapping();
        mapping.loadMapping( this.getClass().getResource(
mappingFile ).toString() );
        java.io.Writer os  = response.getWriter();
        Marshaller marshaller = new Marshaller(os);
        marshaller.setMapping(mapping_);
        // obj is a javabean obj that you have
        // mapped out in your mapping.xml
        marshaller.marshal(obj);

----- Original Message -----
From: "Tim Holloway" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 17, 2002 8:19 PM
Subject: Re: [castor-dev] Here a an interesting article on castor


> Hmmm. It's educational, but still doesn't suggest anything to me - I'm
> interested in using Castor strictly to serialize XML, not for JDO. Unless
> I'm missing out on some major magic here. Which is hardly unlikely, since
> using Javadocs as one's primary programming reference is a great way to
> learn to program trees (usually improperly) while entirely missing out
> on the forest.
>
> Any chance you could show how this works in terms taking a Java collection
of
> homogeoneous beans in a servlet and marshalling them out as XML to the
> servlet response?
>
>   Thanks,
>
>   Tim
>
> On 2002-12-17  19:37 "Lanaghan, Kevin M" wrote:
> > This gets the mapping.xml and database.xml creates a jdo and binds
> > it to the the jndi tree.  All you would need to do for the war case
> > is just place your xml files in the web-inf/classes directory.
> >
> > Hope this helps
> >
> >
> ...
> >
> >
> >
> >
> >
> > --On Tuesday, December 17, 2002 7:08 PM -0500 Tim Holloway
> > <[EMAIL PROTECTED]> wrote:
> >
> > > Sorry, I'm afraid I'm simply too dense to get something that works
> > > from hints and fragments. I posted what I did and what happened -
> > > or didn't - not too long ago, but nobody told me what I did wrong.
> > >
> > >   Tim
> > >
> > > On 2002-12-17  16:43 "Lanaghan, Kevin M" wrote:
> > >> You can use a mapping from a war.  Just put the mapping files in
> > >> the classpath and retrieve it the way you would a properties file
> > >>
> > >>
> > >> --On Tuesday, December 17, 2002 2:10 PM -0500 Tim Holloway
> > >> <[EMAIL PROTECTED]> wrote:
> > >>
> > >> > Personally, I was stopped dead in the water because there was
> > >> > no easy way to use a mapping from a WAR. I admit to some
> > >> > personal self-interest here, but that really DOES seem to me
> > >> > to be a critical need if you want Castor to be seen as a
> > >> > productive tool for webapp development. I solved my particular
> > >> > problem quickly by switching to Zeus, but there's a whole raft
> > >> > of webapp problems that Zeus isn't a good fit for that Castor
> > >> > would be.
> > >> >
> > >> >   Tim
> > >> >
> > >> > On 2002-12-17  10:46 "Colwell, David" wrote:
> > >> >> The testing/development was done using the latest version of
> > >> >> Castor, v0.9.4.1.  The problems I mention are recognized at
> > >> >> least by other members of this mailing list but remain
> > >> >> unsolved. I too would like to hear response to the issues
> > >> >> raised as we plan to continue with Castor on our current
> > >> >> project.  Are others successfully using Castor in an n-tier
> > >> >> environment with a complex data model?  Have they experienced
> > >> >> the same issues and what are their solutions?
> > >> >>
> > >> >> Thanks,
> > >> >> Dave
> > >> >>
> > >> >> -----Original Message-----
> > >> >> From: tek1 [mailto:[EMAIL PROTECTED]]
> > >> >> Sent: Tuesday, December 17, 2002 9:21 AM
> > >> >> To: [EMAIL PROTECTED]
> > >> >> Subject: Re: [castor-dev] Here a an interesting article on
> > >> >> castor
> > >> >>
> > >> >>
> > >> >> what version of castor was used by the person who wrote the
> > >> >> article?
> > >> >>
> > >> >> have the problems that he mentioned by solved in the most
> > >> >> current version  of castor?
> > >> >>
> > >> >> pr-wise, it would be good if someone very experienced with
> > >> >> castor wrote a  response or follow-up on the article to answer
> > >> >> some of the questions raised  by the article.
> > >> >>
> > >> >> thank you.
> > >> >>
> > >> >>
> > >> >>  > O/R Mapping with Castor JDO in the Real World
> > >> >>  >
> > >> >>  > http://www.spiderlogic.com/modules.php?name=News&file=arti
> > >> >>  > cle &sid=16
> > >> >>
> > >> >> -----------------------------------------------------------
> > >> >> If you wish to unsubscribe from this mailing, send mail to
> > >> >> [EMAIL PROTECTED] with a subject of:
> > >> >> unsubscribe castor-dev
> > >> >>
> > >> >> -----------------------------------------------------------
> > >> >> If you wish to unsubscribe from this mailing, send mail to
> > >> >> [EMAIL PROTECTED] with a subject of:
> > >> >> unsubscribe castor-dev
> > >> >>
> > >> > --
> > >> > "The cost benefit outweighs the fact that customer satisfaction
> > >> > levels may dip."
> > >> >
> > >> >    Brian Huff, Datamonitor PLC
> > >> >
> > >> > -----------------------------------------------------------
> > >> > If you wish to unsubscribe from this mailing, send mail to
> > >> > [EMAIL PROTECTED] with a subject of:
> > >> > unsubscribe castor-dev
> > >> >
> > >>
> > >>
> > >>
> > >> ---------------------------------------
> > >> Lanaghan, Kevin M
> > >> Vanderbilt University
> > >> Email: [EMAIL PROTECTED]
> > >>
> > >> -----------------------------------------------------------
> > >> If you wish to unsubscribe from this mailing, send mail to
> > >> [EMAIL PROTECTED] with a subject of:
> > >> unsubscribe castor-dev
> > >>
> > > --
> > > "The cost benefit outweighs the fact that customer satisfaction
> > > levels may dip."
> > >
> > >    Brian Huff, Datamonitor PLC
> > >
> > > -----------------------------------------------------------
> > > If you wish to unsubscribe from this mailing, send mail to
> > > [EMAIL PROTECTED] with a subject of:
> > > unsubscribe castor-dev
> > >
> >
> >
> >
> > ---------------------------------------
> > Lanaghan, Kevin M
> > Vanderbilt University
> > Email: [EMAIL PROTECTED]
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> > unsubscribe castor-dev
> >
> --
> "The cost benefit outweighs the fact that customer satisfaction levels may
dip."
>
>    Brian Huff, Datamonitor PLC
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to