public void doPost(HttpServletRequest req,
              HttpServletResponse resp)
throws ServletException, IOException {
		boolean error = false;
		String errorname= "";
		  UserPojo pj = new UserPojo();
		  DatastoreService dstore = DatastoreServiceFactory.getDatastoreService();
		  
		  /**
		   * Checking to see if the username already exists in the database
		   */
		  Query q = new Query("id");
		  PreparedQuery p = dstore.prepare(q);
		  
		  for (Entity e: p.asIterable()){
			  if(e.getProperty("username")!= null){
			  if (e.getProperty("username").toString().equals(req.getParameter("user"))){
				  error = true;
			  	   errorname = "User already exist";
			  	   break;}}
		  }
		  
		  if(!error){
		  
			pj.setName(req.getParameter("user"));
			pj.setPassword(req.getParameter("pass"));
			pj.setEmail(req.getParameter("email"));
			pj.setAge(req.getParameter("age"));
			pj.setGender(req.getParameter("gen"));
			pj.setLiscence(req.getParameter("lis"));
			pj.setSmoker(req.getParameter("smo"));
			pj.setTransAuto(req.getParameter("transAuto"));
			pj.setTransMan(req.getParameter("transMan"));
			pj.setAddress(req.getParameter("add"));
			pj.setPhone(req.getParameter("phone"));
			pj.setMusic(req.getParameter("music"));
			pj.setInterest(req.getParameter("int"));
			pj.setAbout(req.getParameter("about"));
			pj.setPassRate("0");
			pj.setDrivRate("0");
			pj.setPassCount("0");
			pj.setDriveCount("0");
			
			pj.upData();
			
			
			Properties pro = new Properties();
			Session session = Session.getDefaultInstance(pro, null);
			
			String message = "Dear New User \nWelcome to the RoadTrip application. Please feel free to use this service \nYour user name" +
					"is " + req.getParameter("user") +"\nYour Password is" +req.getParameter("pass") + "\nEnjoy the service\nRegards the road trip team"; 
			
			try{
				Message msg = new MimeMessage(session);
				msg.setFrom(new InternetAddress("wellze92@gmail.com"));
				msg.addRecipient(Message.RecipientType.TO,new InternetAddress(req.getParameter("email")));
				msg.setSubject("Welcome to Road Trip");
				msg.setText(message);
				Transport.send(msg);
			}
			catch(AddressException e){
				
			}
			catch (MessagingException e) {
				
			}	
			
			 PrintWriter out = resp.getWriter();
			    String title = "Register_response" ;
			    out.println(
			                
			    		  "{"+  "\"" + title +"\"" +  ":   { \n" +
				    				
		  		    		   "\t"+  "\"" + "status" +"\"" + ":" +  "\"" + "sucessful" +"\"" + "\n"  + 
							   "} }"
				                
				                );
		  }
		  else{
			  PrintWriter out = resp.getWriter();
			    String title = "Register_response" ;
			    out.println(
			                
			    		  "{"+  "\"" + title +"\"" +  ":   { \n" +
				    				
		  		    		   "\t"+  "\"" + "status" +"\"" + ":" +  "\"" + "fail " + " "  + "\"" + "\n"  + 
							   "} }"
				                
				                );
		  }
}