This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "file access in web application" Watch "file access in web application" New topic
Author

file access in web application

yashendra chandrakar
Greenhorn

Joined: Mar 22, 2002
Posts: 22
hello
friends,
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)
context-root/WEB-INF/web.xml
context-root/WEB-INF/classes/productDetail.jsp
context-root/WEB-INF/classes/registration.jsp
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
Yashendra.
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.
Mustang.
yashendra chandrakar
Greenhorn

Joined: Mar 22, 2002
Posts: 22
Hi
mustang,
what u r saying is absolutely fine.it 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
Rancher

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

Joined: Mar 22, 2002
Posts: 22
thanx
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-
weblogic.httpd.webapp.yash=
/weblogic/myserver/mywebsite
(its perfectly all right)
so here my web application name or context name is "yash"
context-root is
/weblogic/myserver/mywebsite
i have all jsp files in mywebsite folder suppose
mywebsite/shoppingCart.jsp
mywebsite/procedeOrder.jsp
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.
thanx.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: file access in web application