File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Problem in accessing a jsp file from another folder 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 » Engineering » IDEs, Version Control and other tools
Bookmark "Problem in accessing a jsp file from another folder " Watch "Problem in accessing a jsp file from another folder " New topic
Author

Problem in accessing a jsp file from another folder

Sujoy Mukherjee
Ranch Hand

Joined: Dec 31, 2005
Posts: 46

Hello everybody....my question may seems to pretty ordinary to many of you....but as a beginner I am unable to find a solution.....so please help me.

I am using netbeans 7.2. I have created a project, the project hierarchy looks like the following:

FolderDemo
|
|__build
|__dist
|__nbproject
|__src
|__web
|__Folder1
| |__abc.jsp
|
|__Folder2
| |__xyz.jsp
|
|__WEB-INF


Now, my problem relates to abc.jsp and xyz.jsp files. What I am trying to do is that I am trying to access abc.jsp from xyz.jsp.

Here is the code for xyz.jsp:

Now If I right click on xyz.jsp and select run from the pop up menu, it works.....I mean xyz.jsp is coming and when i click on the hyperlink abc.jsp is also coming.
But If I run the project in normal way by clicking on Run button then when i click on the hyperlink on xyz.jsp, abc.jsp is not coming.....instead its giving Http 404 error message.
I don't know what to do? please help me.
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Hello Sujoy Mukherjee,

The project structure looks okay to me , so does the JSP and the href tag. It should work fine. Can you please tell me what link do you use to access the site on the browser ? Must be something similar to localhost:8080/FolderDemo/ ?


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Sujoy Mukherjee
Ranch Hand

Joined: Dec 31, 2005
Posts: 46

Hello Saif,
Thanks for replying.
yes you are absolutely right.....when i am running the project the browser shows http://localhost:8080/FolderDemo/.
Then when i click on the hyperlink, it is showing

HTTP Status 404 -

type Status report

message

descriptionThe requested resource () is not available.

while the browser shows http://localhost:8080/Folder1/abc.jsp as the link.

regards,
Sujoy
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440


It seems that the URL is not appending context name.

Try changing the URL to this



Now the URL formed should be like this

http://localhost:8080/FolderDemo/Folder1/abc.jsp
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in accessing a jsp file from another folder
 
Similar Threads
JSP error page and exception handle
want to open notepad from client machine
Error while forwarding page
Problem with forwarding page towards error page
[solved]Problem with servlet session management