aspose file tools*
The moose likes JSP and the fly likes Including a file 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 a file in JSP" Watch "Including a file in JSP" New topic
Author

Including a file in JSP

Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
I am trying to include a file in a jsp page. The application is running on linex.

I used:


But it is not working.
Any ideas?


SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Error messages would be helpful ;)


JDBCSupport - An easy to use, light-weight JDBC framework -
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
Sebastian Janisch wrote:Error messages would be helpful ;)


The error message was file is not found. The file is there, however.
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
There is a space after the quote sign.
Also, it looks like you are importing a directory and not a file.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Please read this.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Is that path relative to the app?
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
David Newton wrote:Is that path relative to the app?

No, it is an absolute path.



The "/servername" is a mount point on the app server.
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532

Can I provide a absolute path for C:import?

I tried this:

<c:import url="c:/announcement.txt" />


and I got MalformedURLExcption
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Of course not.

The path need to be relative to the web app root.
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
Bear Bibeault wrote:Of course not.

The path need to be relative to the web app root.


Then, in the jsp page, how can I include a file that is outside the web server?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

You can't.

If a file is to be included, it needs to be (and should be) a part of the web app.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Including a file in JSP