• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Including files in servlets

 
Carlin Jones
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all. I'm trying to setup my web app so that I can store some design elements, like the headers and footers, in seperate files that I can change without needing to recompile my sevlets. The way I have it setup right now is I'm running tomcat through apache so is you went to for example http://localhost/ it would be handled by apache but http://localhost/forum/ is handled by tomcat. What I want to do is include a file from the servlet (in /forum/) that is located in the root apache directory. If thats not possible, is there another way of doing it or will I have to manually open the files and print them out inside the servlet?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you should consider forwarding from your servlet to a JSP for presentation? The hybrid servlet/JSP approach solves most problems you might encounter.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Horn"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it
here.
Thanks! and welcome to the JavaRanch!
Mark
 
Carlin Jones
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright. After looking at jsp forwarding for a bit it does seem like its what I should do. But I can't get it to work.
Here is what I have now:

All it does is display the code that comes from the servlet (which is what I would expect it to do since its forwarding). How do I print stuff in the jsp and then include the servlet output?
Whoops. Sorry about the name thing.
[ April 06, 2004: Message edited by: Carlin Jones ]
 
Carlin Jones
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind I think I figured it out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic