aspose file tools*
The moose likes Servlets and the fly likes Including files in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Including files in servlets" Watch "Including files in servlets" New topic
Author

Including files in servlets

Carlin Jones
Greenhorn

Joined: Apr 06, 2004
Posts: 3
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

Joined: Jan 10, 2002
Posts: 61010
    
  65

Perhaps you should consider forwarding from your servlet to a JSP for presentation? The hybrid servlet/JSP approach solves most problems you might encounter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

"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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Carlin Jones
Greenhorn

Joined: Apr 06, 2004
Posts: 3
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

Joined: Apr 06, 2004
Posts: 3
Nevermind I think I figured it out.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Including files in servlets