login page with 2 radio button in java languages
<p>I have a login page and when i run it, it must check which radio button is checked and check database for that radio button.
When I run the codes I get this error:</p>

<pre><code>HTTP Status 500 - Request processing failed;
     nested exception is java.lang.NullPointerException
</code></pre>

<p><img src="https://i.stack.imgur.com/qdjZq.png" alt="enter image description here"></p>

<p>and 
this is my web page:</p>

<pre><code>&lt;form action="/HelloWorldInWeb/login" method="post"&gt;
            &lt;div class="col-lg-12" id="div3"&gt;
              &lt;div class="form-group input-group" id="div4"&gt;
                &lt;div class="input-group-addon "&gt;&lt;span class="glyphicon glyphicon-eye-open "&gt;&lt;/span&gt;&lt;/div&gt;
                    &lt;input type="text" class="form-control" name="username" id="textbox1" placeholder="Enter your username"&gt;
              &lt;/div&gt;
               &lt;div class="form-group input-group" id="div5"&gt;
                &lt;div class="input-group-addon "&gt;&lt;span class="glyphicon glyphicon-eye-close "&gt;&lt;/span&gt;&lt;/div&gt;
                    &lt;input type="text" class="form-control" name="password" id="textbox2" placeholder="Enter your Password"&gt;
              &lt;/div&gt;
                &lt;div class="form-group" id="div6"&gt;
                    &lt;label&gt;&lt;input type="radio" name="sign" name="checkbox" value="adminstrator" id="adminstrator"  checked&gt;Adminstrator&lt;/label&gt;
                    &lt;label&gt;&lt;input type="radio" name="sign" name="checkbox" value="admin" id="admin"&gt;Admin&lt;/label&gt;
                &lt;/div&gt;
                &lt;div class="align"&gt;
                &lt;button type="submit" class="btn btn-danger"&gt;Ok&lt;/button&gt;
                &lt;/div&gt;
            &lt;/div&gt;
     &lt;/form&gt;
</code></pre>

<p>this is my controler servelt:</p>

<pre><code>  @SuppressWarnings({ "null", "static-access"}) 
       @RequestMapping(value="/login" , method = RequestMethod.POST)
       protected void doPost(HttpServletRequest reque, HttpServletResponse response) throws ServletException, IOException {

           response.setContentType("text/html");
           PrintWriter out = response.getWriter();  

           String username=reque.getParameter("username");
           String password=reque.getParameter("password"); 
           String radio=reque.getParameter("checkbox");



        if(radio.equals("admin")){
            Boolean t = stdDAO.validate(username, password);
            if(t){  
                   out.print(username);
                    out.print(password);
                    out.print(" username or password succes");

                    response.sendRedirect("/HelloWorldInWeb/addozvv");  

                }  
                else{  
                    out.print(username);
                    out.print(password);
                    out.print("Sorry username or password error");
                    response.sendRedirect("/HelloWorldInWeb/login");
                }  

               out.close();
        }else
            if(radio.equals("adminstrator")){
                Boolean s = stdDAO.validateadm(username, password);
                if(s){  
                       out.print(username);
                        out.print(password);
                        out.print(" username or password succes");

                        response.sendRedirect("/HelloWorldInWeb/addozvv");  

                    }  
                    else{  
                        out.print(username);
                        out.print(password);
                        out.print("Sorry username or password error");
                        response.sendRedirect("/HelloWorldInWeb/login");
                    }
            }




            }
</code></pre>

<p>this is my validates:</p>

<pre><code>public Boolean validate(String username, String password) {
        boolean t =false;
         try{
             Connection con = dataSource.getConnection();
            PreparedStatement ps =con.prepareStatement
                                ("select * from admins where username=? and password=?");
            ps.setString(1, username);
            ps.setString(2, password);
            ResultSet rs =ps.executeQuery();
            t = rs.next();

         }catch(Exception e)
         {
             e.printStackTrace();
         }
         return t;
    }

    @Override
    public java.lang.Boolean validateadm(String username, String password) {
        boolean s =false;
         try{
             Connection con = dataSource.getConnection();
            PreparedStatement ps =con.prepareStatement
                                ("select * from admin where username=? and password=?");
            ps.setString(1, username);
            ps.setString(2, password);
            ResultSet rs =ps.executeQuery();
            s = rs.next();

         }catch(Exception e)
         {
             e.printStackTrace();
         }
         return s;

    }
</code></pre>