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

including content from webserver in JSP

Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
All,

Am working with application where we are using webserver for content like images, CSS, JS..etc and Appserver for application code.

We are placing all images and able to display in the pages properly. Now we planned to move some static html files as well into the webserver. But, we we used include directive or jsp:include, it is not working.

Any help will greatly appreciated.


Thanks & Regards<br />Mallik Avula<br />SCJP1.4
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

You haven't given us any information that we can use.

But my guess is that you are using page-relative URLs to the various resources. That's fragile and brraks easily.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
Bear Bibeault wrote:You haven't given us any information that we can use.

But my guess is that you are using page-relative URLs to the various resources. That's fragile and brraks easily.


Here is some more information for you.

Assume that header and footer are totally static content. So, I made those as html files - header.html, footer.html

Now, Instead of placing these files in the ear, I want to place in the webserver(Apache) /static directory under htdocs. So that we can change the content without redeploying the ear file.

So, I need to include these files in each page means JSP.

If I say like,


I am getting exception like header.html not found. As I know, it is trying to find the header.html file in the application context path and failed.

My question is: How can I say this file fetch from webserver documents means from /static/header.html from htdocs.

Hope this helps to clarify/help me on this.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Use <c:import> and specify the full path to resource.
Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
We have tried using c:import. In my scenario, i want to include a jsp page from physical location. (say for eg: C:\DynamicPages\ ). If there is any solution. Please help..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

That cannot work. The page must be available via server, not the file system path.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: including content from webserver in JSP