this one i better

Code:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		try
		{
			EmpRegBean empbean;
			Transactionbean userT;
			

			
			if(null !=request.getParameter("empcheck"))
		     {
		      if(request.getParameter("empcheck").equalsIgnoreCase("regemp")) {

		    	  ArrayList<EmpRegBean> empRegList=new ArrayList<EmpRegBean>();
			 empbean = new EmpRegBean();
			 empbean.setName(request.getParameter("name"));
			 empbean.setRole(request.getParameter("role"));
			 empbean.setPhone(request.getParameter("phone"));
			 empRegList=(ArrayList<EmpRegBean>) Dao.Execute1(empbean);
			 HttpSession session = request.getSession(true);
	    	 session.setAttribute("empRegList",empRegList);
		     response.sendRedirect("EmpRegSuccess.jsp");

		      }
		      
		    
		     
		      else if(request.getParameter("empcheck").equalsIgnoreCase("searchemp")) 
		      {
		    	  
		    	  ArrayList<EmpRegBean> empViewList=new ArrayList<EmpRegBean>();
		    	  String empId=request.getParameter("employeeid");
		    	  empViewList= Dao.EmpSearch(empId);
		    	  HttpSession session = request.getSession(true);
		    	  if (empViewList.isEmpty()){
		    		  
		    		  RequestDispatcher rd = getServletContext().getRequestDispatcher("/EmpError.jsp");
						rd.forward(request, response); 
		    	 
		    	  }
		    	  else {
		    		  session.setAttribute("empViewList",empViewList);
			 		  response.sendRedirect("EmpEditDetails.jsp");
		    	  }
		     }
		     
		      else if(request.getParameter("empcheck").equalsIgnoreCase("editemp")) {	 
	 		 empbean = new EmpRegBean();
	 	     empbean.setName(request.getParameter("name"));
	 	     empbean.setEmployeeid(request.getParameter("employeeid"));
	 	     empbean.setRole(request.getParameter("role"));
	 	     empbean.setPhone(request.getParameter("phone"));	 	 
	 	     response.sendRedirect("EmpUpdate.jsp");
	 	      }

		      else if(request.getParameter("empcheck").equalsIgnoreCase("updateemp")) {	 
	 		 empbean = new EmpRegBean();
	 	     empbean.setName(request.getParameter("name"));
	 	     empbean.setEmployeeid(request.getParameter("employeeid"));
	 	     empbean.setRole(request.getParameter("role"));
	 	     empbean.setPhone(request.getParameter("phone"));

	 	     empbean=Dao.EmpUpdate(empbean);
	 	 
	 	       response.sendRedirect("EmpUpdateSuccess.jsp");
	 	      }

		      else if(request.getParameter("empcheck").equalsIgnoreCase("delsearchemp")) 
		      {
		    	  
		    	  ArrayList<EmpRegBean> empViewList=new ArrayList<EmpRegBean>();
		    	  String empId=request.getParameter("employeeid");
		    	  empViewList= Dao.EmpSearch(empId);
		    	  HttpSession session = request.getSession(true);
		    	  if (empViewList.isEmpty()){
		    		  
		    		  RequestDispatcher rd = getServletContext().getRequestDispatcher("/EmpError.jsp");
						rd.forward(request, response); 
		    	 
		    	  }
		    	  else {
		    		  session.setAttribute("empViewList",empViewList);
			 		  response.sendRedirect("EmpDelDetails.jsp");
		    	  }
		    	  
		     }

		      else if(request.getParameter("empcheck").equalsIgnoreCase("delemp")) {	
		    	  empbean = new EmpRegBean();
		    	  empbean.setEmployeeid(request.getParameter("employeeid"));
		    	  empbean = Dao.EmpDelete(empbean);		    	  
		    	  response.sendRedirect("EmpDelSuccess.jsp");
		      }

		      else if(request.getParameter("empcheck").equalsIgnoreCase("viewallemp")) 
		      {
		    	  
		    	  ArrayList<EmpRegBean> empAllList=new ArrayList<EmpRegBean>();
		    	  empAllList= (ArrayList<EmpRegBean>) Dao.EmpViewAll();
		    	  HttpSession session = request.getSession(true);
		    	  session.setAttribute("empAllList",empAllList);
		 		  response.sendRedirect("EmpViewAllDetails.jsp");
		    
		     }
		      else{
		    	   
		    	  RequestDispatcher rd = getServletContext().getRequestDispatcher("/EmpError.jsp");
					rd.forward(request, response);         
			    	}
		      }

Last edited by shabbir; 9Dec2011 at 09:20.. Reason: Code blocks