aspose file tools*
The moose likes Servlets and the fly likes The requested resource (/Person/) is not available. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "The requested resource (/Person/) is not available." Watch "The requested resource (/Person/) is not available." New topic
Author

The requested resource (/Person/) is not available.

Omar Perez
Ranch Hand

Joined: Jul 08, 2011
Posts: 36
Greetings,

Well I'm stuck in a example of the book Head First Servler and JSP, however I don't see why the code is not working as it should. It should display "Person is : Evans"

The Javabean


The Servlet



DD
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

You servlet class (web.xml) should be "servlet.WebServlet" not "WebServlet". You have to specify the whole class name, that includes the package.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61432
    
  67

And, you went through all the trouble to create servlet mapping for the servlet. Why aren't you using it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Omar Perez
Ranch Hand

Joined: Jul 08, 2011
Posts: 36
Koen Aerts wrote:You servlet class (web.xml) should be "servlet.WebServlet" not "WebServlet". You have to specify the whole class name, that includes the package.


I get the same error, with or without the full qualified name.
Omar Perez
Ranch Hand

Joined: Jul 08, 2011
Posts: 36
Bear Bibeault wrote:And, you went through all the trouble to create servlet mapping for the servlet. Why aren't you using it?


It just doesn't work at all, I get the same error.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

You're trying to access /Person/ but you only have a servlet mapping for /servlet.do. I'm also not seeing any filters or other servlet mappings, so what makes you think there even is a /Person/ resource?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Omar Perez
Ranch Hand

Joined: Jul 08, 2011
Posts: 36
Rob Spoor wrote:You're trying to access /Person/ but you only have a servlet mapping for /servlet.do. I'm also not seeing any filters or other servlet mappings, so what makes you think there even is a /Person/ resource?


Servlet.do is a logical name, nothing else. I'm using eclipse and the name of the project is eclipse, so it should upload the app as the project's name "Person".
Piyush Mangal
Ranch Hand

Joined: Jan 22, 2007
Posts: 196
Person would be your web application context name and as you do not have any index.html or index.jsp etc, you need to provide the logical name as well in your url. It should be something like http://localhost:8080/Person/servlet.do assuming your web server is running on 8080 on your local machine.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61432
    
  67

Omar Perez wrote:
Rob Spoor wrote:You're trying to access /Person/ but you only have a servlet mapping for /servlet.do. I'm also not seeing any filters or other servlet mappings, so what makes you think there even is a /Person/ resource?


Servlet.do is a logical name, nothing else. I'm using eclipse and the name of the project is eclipse, so it should upload the app as the project's name "Person".

That makes no sense at all. If the name of the project is "eclipse" what does that have to do with "Person"? And once again, you access servlets through the servlet mappings.
 
Don't get me started about those stupid light bulbs.
 
subject: The requested resource (/Person/) is not available.