Re: Need your suggestion on this,

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

Hopefully I'm understanding the question.  It seems to me that your header 
and footer would be pretty much the same on the various pages, right?  So, 
then why deal with the header/footer stuff in every model?  You don't have 
to cram all your model logic into a single model.  You can have separate 
models for dealing with headers and footers and then have more specific 
models that deal with the main contents of a page.  You might want to try 
compile-time SSI (server side includes) also to simplify this process somewhat.

Does that help?   Have a model that deals with header and/or footer 
information and have other models that deal with the main content of your 
pages.

Jake

At 11:17 PM 4/10/2003 +0800, you wrote:
>Hi,
>
>I have shown the snapshot of my MyPage.html, Header.html, and MyPageModel 
>class of MyPage.java following this message.  MyPage.java basically
>combines Header.html, Footer.html, and other html files into MyPage.html, 
>and is working fine.
>To add a new page of similar kind, say Page1, I copied MyPage.java to 
>Page1.java and MyPage.html to Page1.html. In Page1.java,class name changed 
>to Page1(and other relevant changes),and in Page1.html, all 
>"Dir::Get_Data.MyPage.???" became "Dir::Get_Data.Page1.???" (id became 
>"Page1" etc).
>
>But,I have a problem with Header.html's "Dir::Get_Data.MyPage.Link1" (a 
>BLink). To make it work for Page1, I have to
>change it to "Dir::Get_Data.Page1.Link1", I guess,which means I may have 
>to have separate Header.html file for each new pages
>(not good approach, since Header.html is supposed to be for sharing).
>
>How can solve this problem,or am not to use Blink, but directly use <a 
>href="somedomain.com/~link1" in Header.html file?
>
>Or can I do something in Page1.java within "if(key.equals("Link1")" to 
>make it work?
>Any pointers would be highly appreciated.
>
>Damar
>
>
>======Start of MyPage.html======
>
>!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>[Header]
>[Footer]
>
>====Start of Header.html=====
>
>
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
>=====start of MyPage.java ============
>
>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("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("Link1")){
>                         BLink blink1 = new
>                         BLink("","http://somedomain.com/~link1", vc);
>                         return blink1;
>                 }
>
>
>                 else return super.getItem(key);
>         }
>     }
>}
>
>
>
>
>
>
>_______________________________________________
>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.