Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Adding common header to all JSP pages

Reply
Thread Tools

Re: Adding common header to all JSP pages

 
 
Maxim Senin/J2EE Experts at www.supremistic.com
Guest
Posts: n/a
 
      02-10-2005
Hi.

I have a website built with JSP on tomcat 3.2. Currently is uses HTML
frames for header/body/footer. I want to "flatten" it by getting rid of
header and footer frames.

I don't want to do jsp:include or anything like that in every page.
Stylesheets may not work too: some pages can be displayed on their own, or
same page can be included into another page, so if I did <jsp:include> on
every page I'd get duplicated headers/footers.

I think that the following would work for me: if I could setup some kind of
filter for text/html content, that filter would prepend header and append
footer to ALL pages serving text/html mime type, and i'd do it only once per
screen.

So how can I set up such a filter in tomcat 3.2? Do I need to change
web.xml/server.xml or any other configuration files or deployment descripor?
Is there any other way to do it?

Thanks,
Maxim


 
Reply With Quote
 
 
 
 
Ryan Stewart
Guest
Posts: n/a
 
      02-10-2005
"Maxim Senin/J2EE Experts at www.supremistic.com" <(E-Mail Removed)>
wrote in message news:f1e95$420b0885$436462d4$(E-Mail Removed) rvers.com...
> Hi.
>
> I have a website built with JSP on tomcat 3.2. Currently is uses HTML
> frames for header/body/footer. I want to "flatten" it by getting rid of
> header and footer frames.

Good for you. Frames in general are going away.

> I don't want to do jsp:include or anything like that in every page.
> Stylesheets may not work too: some pages can be displayed on their own, or
> same page can be included into another page, so if I did <jsp:include> on
> every page I'd get duplicated headers/footers.

Look at Tiles. I've only used it as a plug-in for Struts, which I'd also
recommend, but it can be used separately. This might help you start learning
about it:
http://struts.apache.org/userGuide/dev_tiles.html

Off-hand, I can't tell you how to set up up independently of Struts.

> I think that the following would work for me: if I could setup some kind of
> filter for text/html content, that filter would prepend header and append
> footer to ALL pages serving text/html mime type, and i'd do it only once per
> screen.
>
> So how can I set up such a filter in tomcat 3.2? Do I need to change
> web.xml/server.xml or any other configuration files or deployment descripor?
> Is there any other way to do it?

That would be an unusual approach. The concept of filtering is not really for
appending/prepending content to pages.


 
Reply With Quote
 
 
 
 
Maxim Senin/J2EE Experts at www.supremistic.com
Guest
Posts: n/a
 
      02-10-2005
> > So how can I set up such a filter in tomcat 3.2? Do I need to change
> > web.xml/server.xml or any other configuration files or deployment

descripor?
> > Is there any other way to do it?

> That would be an unusual approach. The concept of filtering is not really

for
> appending/prepending content to pages.


Removing tags or adding new tags - what's the difference?


 
Reply With Quote
 
Maxim Senin/J2EE Experts at www.supremistic.com
Guest
Posts: n/a
 
      02-10-2005
> Removing tags or adding new tags - what's the difference?

I suppose any servlet that modifies an original data stream can be called
filter, isn't it?


 
Reply With Quote
 
Steve Sobol
Guest
Posts: n/a
 
      02-10-2005
Ryan Stewart wrote:
> "Maxim Senin/J2EE Experts at www.supremistic.com" <(E-Mail Removed)>
> wrote in message news:f1e95$420b0885$436462d4$(E-Mail Removed) rvers.com...
>
>>Hi.
>>
>>I have a website built with JSP on tomcat 3.2. Currently is uses HTML
>>frames for header/body/footer. I want to "flatten" it by getting rid of
>>header and footer frames.

>
> Good for you. Frames in general are going away.
>
>
>>I don't want to do jsp:include or anything like that in every page.
>>Stylesheets may not work too: some pages can be displayed on their own, or
>>same page can be included into another page, so if I did <jsp:include> on
>>every page I'd get duplicated headers/footers.

>
> Look at Tiles.


I prefer Sitemesh. It skins HTML and JSP pages effortlessly and with little
work, and with no includes required because it runs as a filter:

http://www.opensymphony.com/sitemesh/

I use it with Struts but it can be used outside of Struts easily. It's a
wonderful product.

--
JustThe.net - Apple Valley, CA - http://JustThe.net/ - 888.480.4NET (463
Steven J. Sobol, Geek In Charge / http://www.velocityreviews.com/forums/(E-Mail Removed) / PGP: 0xE3AE35ED

"In case anyone was wondering, that big glowing globe above the Victor
Valley is the sun." -Victorville _Daily Press_ on the unusually large
amount of rain the Southland has gotten this winter (January 12th, 2005)
 
Reply With Quote
 
Maxim Senin/J2EE Experts at www.supremistic.com
Guest
Posts: n/a
 
      02-11-2005

> I prefer Sitemesh. It skins HTML and JSP pages effortlessly and with

little
> work, and with no includes required because it runs as a filter:
>
> http://www.opensymphony.com/sitemesh/


This is exactly what I need. Thanks a lot for the link!

Cheers,
Maxim Senin
http://www.supremistic.com/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can *common* struct-members of 2 different struct-types, that are thesame for the first common members, be accessed via pointer cast to either struct-type? John Reye C Programming 28 05-08-2012 12:24 AM
Header files with "header.h" or <header.h> ?? mlt C++ 2 01-31-2009 02:54 PM
java.lang.NoSuchMethodError: wm.common.session.Common.getCustRptListFromMax Denny Java 1 05-01-2008 07:33 AM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
Want to map all my jsp's to a common Servlet Poorna Java 1 04-06-2006 07:38 PM



Advertisments