Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New to servlets&JSP

 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

I was wondering about what parts of the the mvc need to exist in order for the servlet to run.Because I'm trying to run a servlet that doesnt use a model.

It's just an HTML page that posts some form parameters to a servlet and then the servlet forwards the request to the JSP.Doesn't seem to be able to find the servlet that I defined in the DD...

enlightenment?
Also,what other books are available for SCJP other than the K&B one?I need fresh material...
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was wondering about what parts of the the mvc need to exist in order for the servlet to run.Because I'm trying to run a servlet that doesnt use a model.

Running a servlet has nothing to do with MVC, it can run all on it own.
MVC is a design pattern that simplifies design and maintainance.

All a servelt needs to run is its class file placed in WEB-INF/classes and a mapping in the deployment descriptor web.xml.

Doesn't seem to be able to find the servlet that I defined in the DD...

And what is the error/problem, does it give a 404?
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes a 404...
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The servlet class is in WEB-INF/myPackagename/myPackageName/classes.
The dd is in WEB-INF.
Does the development enviroment have any effect at runtime?Or is it only the deployment enviroment that matters?
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Verify that you have correct servlet mapping in deployment descriptor (web.xml). See Servlet Mapping
 
rakesh sugirtharaj
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is wrong
The servlet class is in WEB-INF/myPackagename/myPackageName/classes.

instead use WEB-INF/classes/
 
Bosun Bello
Ranch Hand
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is it wrong?

Originally posted by rakesh sugirtharaj:
This is wrong
instead use WEB-INF/classes/
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bosun Bello:
How is it wrong?

The package hierarchy starts at WEB-INF/classes, not WEB-INF.
 
Bosun Bello
Ranch Hand
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops! I missed that. Very true indeed. I mis-read the response and thought it was saying WEB-INF/classes is wrong.

Originally posted by Bear Bibeault:

The package hierarchy starts at WEB-INF/classes, not WEB-INF.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic