• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Model CLASS

 
munna next
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am studying HF Servlets and JSP. I am going thru Servlet version2 which demonstrates Model Class and Servlet.

I have two java Source files one is Web1.java and Model1.java. They are in com.example.web and com.example.model packages respectively.
I compiled then with out any error. I have prepared DD and in which I mapper the URL with the class file Web1.class.
I understand that when I request from a page called Index.html the request comes and container able to trace the actual servlet class file thru the DD.
when the equest comes to Servlet then it shoud call the model calss which is Model1.class exists in com.example.model package.
My questions is that how servlet know the location of the model calss ?

Thanks for the reply.
 
Lalitha Mouli
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

The container always looks for a class either under WEB-INF/classes or under WEB-INF/lib/<*.jar> files. If you look at the DDin web.xml, it is a fully qualified class name, say for example if your servlet class name foo.bar.Happy.class
the dir structure will look like WEB-INF/classes/foo/bar/Happy.class

Cheers
SCJP1.4 SCWCD1.4 (preparing)
 
munna next
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand. Thanks for the posting.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic