Re: Servlet

Jacob Kjome <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Yep, you guessed it.  The event model is totally separated from the 
component model.  The component model is the only thing that has a 
dependency on the w3c dom.

You actually load things up yourself via the event handlers.  You'd 
probably want to do something like using a request handler to evaluate 
parameters being sent in and then forward control to the appropriate render 
event handler which would manipulate the DOM and then write the DOM to the 
ServletResponse stream such as....


OutputOptions oo = DefaultDOMWriter.getDefaultOutputOptions(theDocument);
//add doctype - need to do here because XMLC can't yet add the one embedded 
in the html to the DOM
oo.setOmitDocType(false);
oo.setPublicId("-//W3C//DTD HTML 4.01//EN");
oo.setSystemId("http://www.w3.org/TR/html401/strict.dtd");
//now render the DOM
new DefaultDOMWriter().write(theDocument, context.getResponse(), oo);



You can load an XMLC template up by doing...

Document theDocument= 
DefaultDOMLoader.getGlobalInstance().getDOM(MypageHTML.class);

or to get a localize DOM template,

Document theDocument= 
DefaultDOMLoader.getGlobalInstance().getDOM(MypageHTML.class, theLocal);

or using straight XMLC...

Document theDocument= new XMLCStdFactory(null, null).create(MypageHTML.class);


I suggest that you read the component model tutorial:
http://barracudamvc.org/Barracuda/docs/comp/tutorial.html

You might also be interested in Diez' contrib project which uses the "Pages 
model".  Barracuda is written in a way that make many things possible.  The 
pages model provides a mini framework which standardizes how the loading an 
rendering of DOM objects is done.  This may be the approach you are looking 
for.  You can run Diez' pages model by doing...

ant contrib -Dsubproject=dbroggisch -Dsubtarget=catalina-install

You can see the project source by looking under:
src/org/enhydra/barracuda/contrib/dbroggisch

Specifically look at the "page" package within the package above

To look at the example actually using the "page" package, look under...
src/org/enhydra/barracuda/contrib/dbroggisch/webapp


Everything under there is the build for the examples in the contrib 
project.  You can also find a fully separated build by downloading it from 
here:
ftp://ftp.visi.com/users/hoju/pub

If you haven't read the docs, you really should read those.  It would clear 
up a lot of questions.

later,

Jake

At 02:18 PM 4/4/2003 -0500, you wrote:
>My guess is all page data are stored in w3c doc and
>event listeners will update the doc once a request
>fired.
>
>I am not sure if I can or need to extend
>ApplicationGateway, EventXXX, and DispatchXXX just
>like you mentioned for those DefaultEventGateway's. I
>think you may use Java reflect for some of those
>related classes. I don't know how much w3c doc
>specifications you use in those classes/interfaces. It
>looks event model is independent of w3c doc from class
>diagrams. Can you confirm this? If the answer is yes,
>then which method will fire those events for returning
>those response strings from those doc?
>
>Xue-Feng
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.