HELP ME- LOGIN PAGE

HELP ME- LOGIN PAGE

Buongiorno,
Avrei bisogno di un'aiuto nella realizzazione di una LOGIN PAGES al seguito di un login di un'utente registrato
sul sito che sto realizzando.

di seguito vi posto il controller e il richiamo dell jsp e il javascript

CONTROLLER :

@RequestMapping("/login") 
 public @ResponseBody String login(HttpServletRequest request, @RequestParam(value="u", required = true) String username, @RequestParam(value="p", required = true) String password) throws IOException, ParseException{
 

  String page = request.getHeader("referer");

  
  try {
    
   URL url = new URL("http://localhost:8080/svuotacantine-services/rest/auth/login?u="+username+"&p="+password);
   HttpURLConnection conn = (HttpURLConnection) url.openConnection();
   conn.setRequestMethod("GET");
   conn.setRequestProperty("Accept", "application/json");
  
   if (conn.getResponseCode() != 200) {
    throw new RuntimeException("Failed : HTTP error code : "
      + conn.getResponseCode());
   }
  
   BufferedReader br = new BufferedReader(new InputStreamReader(
    (conn.getInputStream())));
  
   String output;
   
   System.out.println("Output from Server .... \n");
   
   
   
   while ((output = br.readLine()) != null) {
    System.out.println(output);    
   }
  
   conn.disconnect();
  
    } catch (MalformedURLException e) {
  
   e.printStackTrace();
  
    } catch (IOException e) {
  
   e.printStackTrace();
  
    }
  
  
  
  System.out.println("Benvenuto: " + username);
  String hashPassword = "";
  String responseCode = "0";
  
  try {
   MessageDigest md = MessageDigest.getInstance("MD5");
   md.update(password.getBytes("UTF-8"));
   byte raw[] = md.digest(); //step 4
 //  hashPassword = (new BASE64Encoder()).encode(raw);
  } catch (NoSuchAlgorithmException e) {
   responseCode = "-2";
  } catch (UnsupportedEncodingException e) {
   responseCode = "-2";
  };
  
  // Controllare che la mail dell'utente registrato sia corretta ed attivata

  
  
  return responseCode;
  
 }

qui ho postato il Javascript, e richiamo jsp :



con quello che ho appena realizzato mi da ERROR DOSOCKET e vari errori di connessione