Moneycontrol Buzzing Stocks

Monday, May 26, 2008

JSP - Concepts

JSP Lifecycle:

Translation Phase: JSP Page will be converted to Servlet.

Compilation Phase: The resulting servlet is compiled.

Instantiate and loading Phase: Instance will be created for the servlet ands it will be loaded to memory.

Call jspinit():Perform Initialization process.

Call _jspService(): this will be called upon each request.

Call jspDestroy(): the instance will be destroyed when not needed any more.

Friday, May 23, 2008

Simplified Struts concepts

  • A request comes in from a Java Server Page into the ActionServlet.
  • The ActionServlet having already read the struts-config.xml file, knows which form bean
    relates to this JSP, and delegates work to the validate method of that form bean.
  • The form bean performs the validate method to determine if all required fields have been
    entered, and performs whatever other types of field validations that need to be performed.
  • If any required field has not been entered, or any field does not pass validation, the form bean generates ActionErrors, and after checking all fields returns back to the ActionServlet.
  • The ActionServlet checks the ActionErrors that were returned from the form bean’s validate method to determine if any errors have occurred. If errors have occurred, it returns to the originating JSP displaying the appropriate errors.
  • If no errors occurred in the validate method of the form bean, the ActionServlet passes
    control to the appropriate Action class.
  • The Action class performs any necessary business logic, and then forwards to the next
    appropriate action (probably another JSP).