File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes file access in web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "file access in web application" Watch "file access in web application" New topic

file access in web application

yashendra chandrakar

Joined: Mar 22, 2002
Posts: 22
i were developing a web application using jsp.i made following directroy hierarchy in context root of my web application
context-root/images(image files folder)
context-root/index.jsp(specified in web.xml as welcome-file)
1)i have to make a link in index.jsp for accessing productDetail.jsp.
now, how to specify path for this in html tag <A HREF= >

2)i'm using a javascript file & a html file with registration.jsp,
where should i put these javascript & html files
i have not specified these jsp files in web.xml using <servlet> <jsp-file> tags
thanx in advance
mustang india
Ranch Hand

Joined: Feb 05, 2002
Posts: 60
I dont understand why u have put the JPSs in the classes directory. As far as my knowledge goes, they have to be in context-root/xxx.jsp, along with ur index.jsp.
U can access them as "/context-root/xxx.jsp"
All ur HTML files should be in ur context-root.
JavaScript files can be in the same directory or can go into any directory just as u have donw with ur images. This is optional.
I hope this caters ur need.
yashendra chandrakar

Joined: Mar 22, 2002
Posts: 22
what u r saying is absolutely works perfectly when i put all files in context root of my server,but this way it will be part of default web application,and then same ServletContext object w'll be shared with other applications, which are part of default application.what i want is to deploy my project as separate web application
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Look at the examples that come with Tomcat or download the servlet API from to see how to set up a separate "web application" - it really is very simple.
yashendra chandrakar

Joined: Mar 22, 2002
Posts: 22
mustang & William,
i tried as mustang said,now its working with some extent,but still facing problem.
i have registered web application in my weblogic server as follows-
(its perfectly all right)
so here my web application name or context name is "yash"
context-root is
i have all jsp files in mywebsite folder suppose
in shoppingCart.jsp,i'm using
<jsp:forward path='procedeOrder.jsp'/>
but it says resource '/yash/procedeOrder.jsp' not
found in context-root /weblogic/myserver/mywebsite
But same code is working in default context of server.can u tell me any link, where i can get information about making web application using jsp.
I agree. Here's the link:
subject: file access in web application
It's not a secret anymore!