Re: Further suggestion please?]

Jacob Kjome <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi Damar,

Glad you figured things out :-)

BTW, you might be interested in something David Li posted to the XMLC list.

http://xmlc.enhydra.org/project/mailingLists/xmlc/msg02204.html

Basically, you can use a new feature added to XMLC-2.2alpha2 (current 
release is alpha4) in XMLCContext where you can quite simply load plain 
html files at runtime and it will give you a Document object.  This might 
be better than having to compile headers, footers, and the like.  I haven't 
tried it yet, so you'll have to experiment.  You might also think about 
using compile-time SSI (server side includes).

Oh, and if you use BTemplate and return a node tree which contains 
BTemplate directives, those directives should also be processed by their 
respective models.  That seems like something you might run into 
here.   But seeing as you solved your issue, maybe not.  Just figured I'd 
mention it.

You can grab the XMLC-2.2 stuff from the latest Barracuda CVS or grab it at:
http://debian-sf.objectweb.org/project/showfiles.php?group_id=49

Note that the XMLC-2.2 jars in Barracuda are actually more recent than 
alpha4 and has at least one fix that is pretty important.

Jake

At 12:32 PM 3/28/2003 +0800, you wrote:

>Hi Jake,
>
>It is me again.
>
>Just to let you know that I just found the sources on the link you
>provided yesterday, and using that I managed to use BLink.  There are a
>lot other useful stuff as well.
>
>On going through that, should I require the assistance of the list, I will
>get back again.  But, in the mean time, any suggestions on my approach, or
>any mistake I may have done in my process, would be highly appreciated.
>
>Thanks.
>
>Damar
>
>On Fri, 28 Mar 2003 [email protected] wrote:
>
> > Hi Jake,
> >
> > Firstly, thanks a lot for your time.
> >
> > I have the following model code:
> >
> > public class MyPage extends ComponentGateway {
> >
> >      private static XMLCFactory xmlcFactory = null;
> >
> >     public Document handleDefault (BComponent root, ViewContext vc,
> > HttpServletRequest req, HttpServletResponse resp) {
> >         if (xmlcFactory==null) xmlcFactory = new
> > XMLCStdFactory(this.getClass().getClassLoader(), new StreamXMLCLogger());
> >         XMLObject page =
> > xmlcFactory.create(mypage.presentation.MyPageHTML.class);
> >
> >         BTemplate templateComp = new BTemplate(new MyPageModel());
> >         templateComp.setView(new
> > DefaultTemplateView(page.getElementById("MyPage")));
> >
> >         root.addChild(templateComp);
> >
> >         return page;
> >     }
> >
> >     /* MypageModel */
> >
> >     class MyPageModel extends AbstractTemplateModel {
> >
> >         //register the model by name
> >         public String getName() {
> >             return "MyPage";
> >         }
> >
> >         //provide items by key
> >         public Object getItem(String key) {
> >             ViewContext vc = getViewContext();
> >             if (key.equals("Title")) return "MyPage Title";
> >             else if (key.equals("Header")){
> >               XMLObject header =
> > xmlcFactory.create(mypage.presentation.HeaderHTML.class);
> >               Node headerNode = header.getElementById("header");
> >               return
> > vc.getElementFactory().getDocument().importNode(headerNode, true);
> >               }
> >           else if (key.equals("Menu")){
> >               XMLObject menu =
> > xmlcFactory.create(mypage.presentation.MenuHTML.class);
> >               Node menuNode = menu.getElementById("menu");
> >               return
> > vc.getElementFactory().getDocument().importNode(menuNode, true);
> >               }
> >             else if (key.equals("Footer")) {
> >                 XMLObject footer =
> > xmlcFactory.create(mypage.presentation.FooterHTML.class);
> >                 Node footerNode = footer.getElementById("footer");
> >                 return
> > vc.getElementFactory().getDocument().importNode(footerNode, true);
> >             }
> >            else if (key.equals("MainText")) {
> >               XMLObject mainText
> > =xmlcFactory.create(mypage.presentation.MainTextHTML.class);
> >               Node mainTextNode = mainText.getElementById("mainText");
> >               return
> > vc.getElementFactory().getDocument().importNode(mainTextNode, true);
> >       }
> >
> >               else return super.getItem(key);
> >         }
> >     }
> > }
> >
> > As you can see, the above model has combined four html files, viz.
> > Header.html, Footer.html, Menu.html and MainText.html, into MyPage.html.
> > Among these html files, Header.html contains some images, Footer contains
> > some images with external links, and MainText few paraphaphs of text.
> >
> > The following is my Menu.html:
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML4.01//EN"
> > "http://www.w3.org/TR/html4/strict.dtd">
> > <html id="MyPage">
> > <head><title>menu</title></head>
> > <body>
> > <table id="menu" border="0" width="222">
> > <tr>
> > <td height="41" width="220"><a
> > href="http://mydomain.net:8002/mypage"/>
> > <img height="41" src="graphics/greenHome.jpg" width="220"/>
> > </td>
> > <td height="41" width="220"><a
> > href="http://mydomain:8002/page1"/>
> > <img height="41"src="graphics/blueHome.jpg" width="220"/>
> > </td>
> > </tr>
> > </table>
> > </body>
> > </html>
> >
> > Now, Menu.html has two buttons, greenHome.jpg and blueHome.jpg, linking
> > mypage and page1 respectively.  What I am trying to do (1) I generate new
> > pages, replacing MainText.hmtl with new files or content in the model, and
> > (2) Add a button in Menu.html to hyperlink those files.
> >
> > (page1, by the way, is just page, all similar to mypage, except the
> > content of MainText.html).
> >
> > How I have hyperlinked in Menu.html file now may not work (they are
> > exactly like I have done in Footer.html to hyperlink external URLs), if I
> > run this program in different hosts. So, I guess, using BLinks may be the
> > solution, but I do not know how to use it here.
> >
> > In the following code in the model, relating to Menu.html:
> >
> >  else if (key.equals("Menu")){
> >                 XMLObject menu =
> > xmlcFactory.create(mypage.presentation.MenuHTML.class);
> >                 Node menuNode = menu.getElementById("menu");
> >                 return
> > vc.getElementFactory().getDocument().importNode(menuNode, true);
> >                 }
> >
> > It simply add the complete DOM tree of a table into MyPage.html.  How
> > can I get into Button ie <a level and do some linking? What changes do I
> > have to do in Menu.html?
> >
> > Thanks once again, and my apology that I may have included unnecessary
> > detail here, or may not have include necessary ones.
> >
> > Damar
> >
> >
> > > >
> > > >
> > > > -------- Original Message --------
> > > > Subject: Re: [Barracuda] Further suggestion please?
> > > > Date: Thu, 27 Mar 2003 08:03:05 -0600
> > > > From: Jacob Kjome <[email protected]>
> > > > Reply-To: [email protected]
> > > > To: [email protected]
> > > >
> > > >
> > > >
> > > >
> > > > Hi Damar,
> > > >
> > > > I guess what I meant in my earlier message was to provide the actual
> > > > relevant code that you use.  Do you use BTemplate?  If you can 
> provide a
> > > > snippet of the relevant html in question and a snippet of the relevant
> > > > model code where you return BComponents, then we can see what you might
> > > > be doing wrong.  The information below doesn't tell me a whole lot that
> > > > is relevant to the issue at hand; getting BLink to work for 
> you.  Like I
> > > > said before, take a look at:
> > > > http://barracudamvc.org/Barracuda/CompTest5
> > > >
> > > > This corresponds to the sourcecode at...
> > > > org/enhydra/barracuda/examples/xmlc
> > > >                                                           /CompEx5.html
> > > >                                                           /CompEx5.java
> > > >
> > > > This example is all about testing out the BLink component so you should
> > > > find your answer here.  This should be in the Barracuda-1.1.1 release
> > > > that shipped with Enhydra-5.0.
> > > >
> > > > BTW, are you using any BComponents?  Is this just a question in general
> > > > about using Barracuda components or do you use a bunch of 
> components but
> > > > just don't know how to use a BLink component?  You need to provide more
> > > > of a context for those of us who would like to help.
> > > >
> > > > I also noticed your other message about using Enhydra-5.0.
> > > > Unfortunately, I can't be of any help there.  I don't have a clue about
> > > > how to use Enhydra (I used it long ago, and can't remember much about
> > > > it).  Might I suggest getting things working under Tomcat-4.1.24 and
> > > > then migrating that to Enhydra?
> > > >
> > > > Jake
> > > >
> > > > At 03:57 PM 3/27/2003 +0800, you wrote:
> > > >
> > > > > Following Jake's and my earlier message, I did the followings to
> > > > > add a new Page:
> > > > >
> > > > > 1.      Page1 was created (combining header.html, footer.html,
> > > > > menu.html, and the Page1Text.html).  I copied Page1.html to 
> Page2.html,
> > > > > make it to use Page2Text.html in Page1Text.html's place, and 
> edited all
> > > > > relevant entries.
> > > > >
> > > > > 2.      Copy Page1.java to Page2.java and edited all relavant 
> entries.
> > > > >
> > > > > 3.      web.xml is edited so that page1 and page2 can be accessed
> > > > > through http://mydomain.com:8002/page1 and
> > > http://mydomain.com:8002/page2
> > > > > respectively.
> > > > >
> > > > > 4.      Two buttons, page1 and page2, are added in Menu.html, making
> > > them
> > > > > to point to above URL's respectivey, using <a tags.
> > > > >
> > > > > After compilling, it is working fine.
> > > > >
> > > > > My question here is:
> > > > >
> > > > > I have not used Blink component here (I still do not know how to 
> use it
> > > > > either!), what are the advantages, if I use Blink component here? Or,
> > > any
> > > > > other methods that Barracuda may provide?
> > > > >
> > > > > Any pointers would be highly appreciated.
> > > > >
> > > > > Damar
> > > > >
> > > > > _______________________________________________
> > > > > Barracuda mailing list
> > > > > [email protected]
> > > > > http://barracudamvc.org/lists/listinfo/barracuda
> > > >
> > >
> > >
> > >
> >
> > _______________________________________________
> > Barracuda mailing list
> > [email protected]
> > http://barracudamvc.org/lists/listinfo/barracuda
> >
> >
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://barracudamvc.org/lists/listinfo/barracuda
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.