Class AddCategoryServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--AddCategoryServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class AddCategoryServlet
extends javax.servlet.http.HttpServlet

This class displays the form, through which the sysad can add new categories and the feature to those categories. Assumptions: It is assumed when the parent category is not a final category. i.e, I should not try to create a category in say RAM. For this we need to check if parent category already contains some product for auction. In that case it won't be final.

See Also:
Serialized Form

Constructor Summary
AddCategoryServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          doGet - displays the form with One input box to take new category name.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          doPost - recieves the data posted from doGet method.
 void init()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddCategoryServlet

public AddCategoryServlet()
Method Detail

init

public void init()
Overrides:
init in class javax.servlet.GenericServlet

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
doGet - displays the form with
  1. One input box to take new category name. It checks (by using query from QueryEngine) whether that category name is not already present in the parent category.
  2. Then twenty 20 rows are displayed here to add features of the category to be added an with types of each feature.
Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
HttpServletRequest - request
HttpServletResponse - response

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
doPost - recieves the data posted from doGet method. And accordingly updates the database by adding the new category to database. Suitable messages are displayed to indicate whether the:
  1. Category name was already present.
  2. some problem occured during update to database.
  3. the update executed successfully.
Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
HttpServletRequest - request
HttpServletResponse - response