aspose file tools*
The moose likes Servlets and the fly likes Why is my jsp not available? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Why is my jsp not available?" Watch "Why is my jsp not available?" New topic
Author

Why is my jsp not available?

Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96
hi,
I have a very small jsp-servlet application. Name of the application is myfirstwebapp. I have a folder structure like the following :
Tomcat --> webapps --> myfirstwebapp --> WEB-INF

Inside my WEB-INF, I have my classes folder and the web.xml file. Along with the web-inf folder, I also have helloworld.jsp in the myfirstwebapp folder. When I start Tomcat and type http://localhost:8080/myfirstwebapp/helloworld, the browser throws a 404 error and says "requested resource() not available"
I double checked and all names etc are correct, so its not a case of my application name being myfirstwebapp and me typing myfistwebapp....or something like that. Another thing that I found out is...if I remove the web.xml file from the project folder, the web page becomes available, but the moment I put it back, the page becomes unavailable again.
Can you please help me find out my error?

Thanks in advance for all your help.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
If the page is named "helloworld.jsp", then that's what you need to use in the URL, not just "helloworld".
Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96
I tried even that...and yet its not able to find
Aniruddh Joshi
Ranch Hand

Joined: Jul 29, 2008
Posts: 275

Where is the jsp located ?
can you please add a screenshot of the directory structure ?


Anrd
"One of the best things you could do is to simplify a larger application into a smaller one by reducing its process and complexity - Fowler"
Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96
here are the 2 screenshots. One of them shows the directory structure till the jsp, while the other shows the error that the browser gives when I try to run the page



[Thumbnail for folder_structure.jpg]


[Thumbnail for error.jpg]

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
So http://localhost:8080/myfirstwebapp/helloworld.jsp does not work, but http://localhost:8080/myfirstwebapp/firstpage.html does?
Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96
I tried after I read your post. It doesnt work. But since my page is named helloworld.jsp, and not helloworld.html...isnt that expected?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3860

Souvvik Basu wrote:I tried after I read your post. It doesnt work. But since my page is named helloworld.jsp, and not helloworld.html...isnt that expected?

What you get when you access the html file?
But since my page is named helloworld.jsp, and not helloworld.html...isnt that expected?

Both should be accessible if everything is alright...


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
Souvvik Basu wrote:It doesnt work. But since my page is named helloworld.jsp, and not helloworld.html...isnt that expected?

Re-read my post carefully - I was asking about firstpage.html, not helloworld.html. Reason being that the file is part of your web app.
Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96
Sorry...missed out that part. No, even that is not available. But as I said, it gets available (both of them) if I remove the web.xml file from the WEB-INF folder.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
Are there any error messages in the log files?
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4491
    
    8

It might be worth posting the web.xml file, as it sounds like the issue is probably there.
Souvvik Basu
Ranch Hand

Joined: Apr 05, 2010
Posts: 96
Here is the web.xml file



I didnt find any error messages in the log file.
I just made a fresh web application, and this time, the problem is gone. The web pages are available, even though the directory structure is same as the previous one. I'm not sure if it was a case of some internal problem with Tomcat itself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why is my jsp not available?