I glued xform and castor together, now we can get an object directly out of
html form. The code is fairly simple. They are for demostration purpose
only. We can cache appForm, validate against XML Schema and all that good
stuffs. 

                        //the file contains form to be shown in UI
                        XForm appForm = XParser.parseFile(dir +
File.separator + fileName);
                        //spit out the html code to the response
                        out.println(appForm.write(request));

                        //convert the request to DOM
                        Document record = appForm.getRecord(request);
                        //print out DOM at server
                        System.out.println(appForm.writeRecord(request));

                        //Marshall DOM to object
                        Form form = (Form)
Unmarshaller.unmarshal(Form.class, record);
                        //print out an field
                        System.out.println(form.getEmail());

Attached is a zip file containing the JBuilder 5 project and a war file for
WebLogic 6.0. Of course, to run it, you need xform.jar, castor.jar and
xercesJ.jar. If you couldn't fine it on the web, please let me know. 


-----Original Message-----
From: Ru, Simon 
Sent: Thursday, July 26, 2001 3:29 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [castor-dev] XFORM


Ha, I was hoping you guys will put it together so I can just download it. :)

Okay, I will look into it. 

-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 26, 2001 3:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] XFORM



Great, let us know if you get it to work.

--Keith


"Ru, Simon" wrote:
> 
> The following link has a really nice tool to convert html form into XML.
If
> we hook that tool up with the data binding your presented, we can create
> java object directly from html form submit, which would then use JDO to
> insert into data. All in probably couple lines of code.
> 
> http://xform.nanoworks.org/XForm_0.3/README.html#Documentation
> 
> Simon Ru
> Software Engineer
> (510) 897-5331
> http://www.worldchain.com
> 
> --------------------------------------------------------------------------
> Note:  The information contained in this message may be privileged and
> confidential and protected from disclosure. If the reader of this message
is
> not the intended recipient, or an employee or agent responsible for
> delivering this message to the intended recipient, you are hereby notified
> that any dissemination, distribution or copying of this communication is
> strictly prohibited. If you have received this communication in error,
> please notify us immediately by replying to the message and deleting it
from
> your computer. Thank you.
> --------------------------------------------------------------------------
> 
> -----------------------------------------------------------
> 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

-------------------------------------------------------------------------- 
Note:  The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and deleting it from
your computer. Thank you. 
--------------------------------------------------------------------------
  

untitled2.zip

Reply via email to