Re: Using Jivan
Jacob Kjome <[email protected]> Thu, 26 May 2005 00:07:58 -0500
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format...
------------=_1117084117-26800-2
Content-Type: text/plain; charset="us-ascii"; format=flowed
Hi Franck,
Sorry for the late response, but this should get you going...
It's been a while since I tried using Jivan, but the following should do
the trick...
<global-repository-setup>
<!-- Set the default dom factory for the global instance of the
default dom loader -->
<object name="$this">
<method name="getServletContext" return="$sc"/>
</object>
<object name="$df" class="org.barracudamvc.core.util.dom.JivanDOMFactory">
<!-- set the servlet context so that the dom factory can read
web.xml context params and/or find files relative to the servlet context
root such as "/WEB-INF/templates/foo.html" -->
<method name="setServletContext" arg1="$sc" />
</object>
<object class="org.barracudamvc.core.util.dom.DefaultDOMLoader">
<method name="getGlobalInstance" return="$dl" />
</object>
<object name="$dl">
<method name="setDefaultDOMFactory" arg1="$df" />
</object>
</global-repository-setup>
Then do...
Document doc =
DefaultDOMLoader.getGlobalInstance().getDOM("/WEB-INF/templates/foo.html",
someLocale);
Among the "pitfalls" of using Jivan rather than XMLC are that you no longer
have custom document interface which can be checked at compile-time to make
sure that the markup file matches what your code is expecting it to
have. Some like this, some don't care so much. I think both are
legitimate choices depending on your needs.
BTW, you can mix DOMFactories by doing...
DOMLoader loader = DefaultDOMLoader.getGlobalInstance();
loader.registerDOMFactory(jivanDOMFactory, "/WEB-INF/templates/foo.html");
loader.registerDOMFactory(xmlcDeferredParsingDOMFactory,
"com.mycompany.ui.MyPageHTML");
This can also be done in the object repository config (note to self, we
really should make that a groovy script rather than the cumbersome custom
XML config language that it is currently)
Jake
At 11:24 AM 5/20/2005 +0200, you wrote:
>Hi all,
>
>I would like to test using Jivan to parse/render my app.
>
>I could'nt find any doc explaining how to do that (even in
>JivanDOMWriter JivanDOMFactory source).
>I can recall there was a discussion on it 1 or 2 years ago, but what is
>the status of it now... I could'nt tell.
>
>So my questions are :
>
>- what are the steps to use Jivan ?
>
>currently I use ApplicationGateway to handle the events and extend
>BTemplateViewHandler to render my pages...
>
>- are there any pitfalls in using jivan instead of xmlc ?
>
>Thanks in advance,
>
>Franck
>
>
>
>--
>Barracuda mailing list
>[email protected]
>http://www.objectweb.org/wws/lists/projects/barracuda
------------=_1117084117-26800-2
Content-Type: text/plain; name="message.footer"
Content-Disposition: inline; filename="message.footer"
Content-Transfer-Encoding: 8bit
--
Barracuda mailing list
[email protected]
http://www.objectweb.org/wws/lists/projects/barracuda
------------=_1117084117-26800-2--