Netbeans - filepath problem

I need to reference a file from a sub-directory location. The file in the main directory, where the sub-directory is located. How do I accomplish this ? I am using NetBeans IDE 4.1.
kgprettyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hujiCommented:
Not sure if I've understood what you mean. Also, I have never used NetBeans IDE. What I offer here is the general rules:

(1) If the linking file is in folder X, and the linked file is a subfolder of this X, named Y, the link should be like: <a href="Y/linked.htm">

(2) If the linking file is in folder Y, which is inside folder X, and the linked file is in the folder X, the link should be like: <a href="../linked.htm">

Hope I'm not far from what you need.
Huji
0
kgprettyAuthor Commented:
Not quite, I don't need anchor links. Let's say you had a web application with a main directory and other folders inside that main directory. If you were inside the folder, how would you reference for example an image in the main directory?
0
hujiCommented:
Well perhaps this is because I don't understand the meaning of "link" in the world of Netbeans. I will do more research and be back.
Huji
0
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

hujiCommented:
>>  how would you reference for example an image in the main directory?
If that is going to be in HTML, again you may use the ../ trick like this: <img src="../file.gif" width="19" height="23" alt="">
However, since I think I may be totally misunderstanding your question, I've asked JSP experts to pay attention to this thread. I recommend you up the points if you can, to attract those experts. ( http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_21798329.html )
Wish I can help
Huji
0
kgprettyAuthor Commented:
Thanx.. I'll wait for someone to answer..
0
rrzCommented:
Are you using JSP ? Which container ? Tomcat ?
0
rrzCommented:
Ok
Try making file paths relative to your container.    
<img src="<%=request.getContextPath()%>/MyImage.gif"/>  
or if you  are not talking about  links then use  something like  
String filePath = application.getRealPath("/MyImage.gif");  
0
kgprettyAuthor Commented:
I actually need a file to be included in my jsp page. I tried this:
<%@ include file = "request.getContextPath()/weselldvdsDSNconn.jsp" %>
but I received an error which said: "quote symbol expected."
0
rrzCommented:
><%@ include file = "request.getContextPath()/weselldvdsDSNconn.jsp" %>
If  weselldvdsDSNconn.jsp  is in your web app's root directory then you could use
<%@ include file = "/weselldvdsDSNconn.jsp" %>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kgprettyAuthor Commented:
wow.. so simple. Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.