Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

mvc  RSS feed

 
srinivasan doraiswamy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually in mvc which separates the controller from the view and the model
Is it the web container or any other thing? I need explanation. Will anybody help?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its nothing out of this world. it is not the container, nor something else. its YOU who seperate the

model from view and control
view from model and control
control from model and view

it is like,

view --- > controller ------> model
model ----> controller ------> view
 
srinivasan doraiswamy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks adeel

I've another doubt how to call servlet context inside service/doget/dopost methods after calling init method without passing servletconfig as a parameter inside init method

srinivasan

SCJP 1.4
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what do you mean by after calling init(). you are not going to call init() anywhere, is it clear?

i hope it will clear your concept.


The servlet context is initialized when the Web application is loaded, and is contained
in the ServletConfig object that is passed to the init() method. Servlets
implementing the GenericServlet interface (directly or indirectly) can invoke the
getServletContext() method to get the context reference, because
GenericServlet implements the ServletConfig interface.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by srinivasan doraiswamy:
calling init method without passing servletconfig as a parameter inside init method


you must know this about init()

The container initializes the servlet by invoking its init() method, passing
an object implementing the ServletConfig interface. In the init() method, the
servlet can read configuration parameters from the deployment descriptor or perform
any other one-time activities, so the init() method is invoked once and only once by
the servlet container.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!