Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in accessing a jsp file from another folder

 
Sujoy Mukherjee
Ranch Hand
Posts: 51
Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/ ?
 
Sujoy Mukherjee
Ranch Hand
Posts: 51
Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic