• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Invocation  RSS feed

 
Sani babangida
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All, I am new to servlets and I have a Question
I have a servlet

Public class one extends HttpServlet{

public void init(javax.servlet.ServletConfig config){
//do Something
}
public void doPost(HttpServletRequest aRequest, HttpServletResponse aResponse){
//do something
}

}

now I want to add a method (PerformXXX(String inValue) )to this servlet which is suppose to call the do post.(considering the doPost only accepts parameters HttpServletRequest and HttpServletResponse) How do I go about this, and how do I make sure the init would at least be executed at start up.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You dont call doPost. The container does that for you. I would suggest putting the business logic in separate classes or EJBs. Dont put functions that dont belong in the controller (servlet) in the controller (assuming your perform function is a business function ). The init method is called the first time the servlet is called. Hmmm... you should be using init() instead of init(ServleConfig), that way you dont have to call the super's init(config).
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!