This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Folder Mapping in web application. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Folder Mapping in web application." Watch "Folder Mapping in web application." New topic
Author

Folder Mapping in web application.

Huang Jian Tian
Greenhorn

Joined: Oct 31, 2004
Posts: 14
hi all,
I would like to ask, is it possible for us to map a folder in web application?
For example, my web application contains a /images folder which contain all images used in my application. So, when I need to load a image from my jsp page, i would only required to specify something like images/myPic.gif instead of ../images/myPic.gif (note that ../images/myPic.gif is depend on how deep is the jsp file from the images folder).

Any response will be much appreciated. thanks
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"wanted",
You have already been wanred about your display name here.

Please see the link and update your profile with a valid display name soon, since accounts with invalid display names get deleted, often without warning.

thanks,
Dave.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

There are a number of solutions, butI think the one you're looking for is to cretae a Servelt as a 'virtual directory'. To do this, you create a Servlet mapping which looks like a directory, then get the servlet to query the URL and serve the actual image. ie you create a mapping as */images/ and */images/* to your servlet, but I can't remember the actual method for getting the rest
Huang Jian Tian
Greenhorn

Joined: Oct 31, 2004
Posts: 14
hi Dave,
Sorry for my nickname, actually i was not notified by JavaRanch in the previous forum at http://www.coderanch.com/t/75855/Websphere/Storage-Websphere-Embedded-JMS-Provider.
I've taken and change my displayed name to 'huang' which is my surname, is it ok?

Thanks for the suggestion, i will give it try...wish me good luck...:-)

huang
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Thanks for trying, but your name is still not valid.

We require your display name to be two words: your first name, a space, then your last name. Obviously fictitious names are not allowed.

Thanks for your cooperation.
Dave.
Huang Jian Tian
Greenhorn

Joined: Oct 31, 2004
Posts: 14
hi David,
OK, I will change my name accordingly. By the way, why i'm not being notified when someone reply to this topic?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

It doesn't look like you've added an email address to your profile. I may be wrong, but nothing is showing.

Thanks for fixing your display name. All happy now
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by David O'Meara:
There are a number of solutions, butI think the one you're looking for is to cretae a Servelt as a 'virtual directory'. To do this, you create a Servlet mapping which looks like a directory, then get the servlet to query the URL and serve the actual image. ie you create a mapping as */images/ and */images/* to your servlet, but I can't remember the actual method for getting the rest


SimpleStream at http://simple.souther.us does this. In the example, I'm serving the images from a directory under WEB-INF. If you want to use it in production, you'll need to make sure you have mime types listed for every extension you plan to use. You'll see in in the servlet code.
[ January 16, 2005: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Folder Mapping in web application.
 
Similar Threads
Changing <context-root>
Deliver Static content
Inserting images on JSP page
Current directory
Servlet-Applet communication problem