title: How to get parameter name in case of spring security?
body: <p>I want to retrieve the parameters sent through the form login.jsp in the controller..but I am getting the  error-"Request parameter is not present". My code for login.jsp is as follows:-</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
    &lt;title&gt;Spring Security&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;center&gt;
  
    &lt;h1&gt;Welcome to Spring Security Learning&lt;/h1&gt;
    &lt;c:if test="${not empty SPRING_SECURITY_LAST_EXCEPTION}"&gt;
      &lt;font color="red"&gt;
        Your login attempt was not successful due to &lt;br/&gt;&lt;br/&gt;
        &lt;c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/&gt;.
      &lt;/font&gt;
    &lt;/c:if&gt;
  
    &lt;div style="text-align: center; padding: 30px; border: 1px solid; width: 250px;"&gt;
  
      &lt;form method="post"
            action='j_spring_security_check'&gt;
  
        &lt;table&gt;
  
          &lt;tr&gt;
  
            &lt;td colspan="2" style="color: red"&gt;${message}&lt;/td&gt;
  
          &lt;/tr&gt;
  
  
          &lt;tr&gt;
  
            &lt;td&gt;User Name:&lt;/td&gt;
  
  
            &lt;td&gt;&lt;input type="text" name="j_username" id="uname"/&gt;&lt;/td&gt;
  
          &lt;/tr&gt;
  
  
          &lt;tr&gt;
  
            &lt;td&gt;Password:&lt;/td&gt;
  
  
            &lt;td&gt;&lt;input type="password" name="j_password" /&gt;&lt;/td&gt;
  
          &lt;/tr&gt;
  
  
          &lt;tr&gt;
  
            &lt;td colspan="1"&gt;&lt;input type="submit" value="Login" /&gt;&lt;/td&gt;
  
  
            &lt;td colspan="1"&gt;&lt;input name="reset" type="reset" /&gt;&lt;/td&gt;
  
          &lt;/tr&gt;
  
        &lt;/table&gt;
  
      &lt;/form&gt;
  
    &lt;/div&gt;
  
  &lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The code for controller is as follows:-</p>
  
  <pre><code> @RequestMapping("/search")
      public ModelAndView search(HttpSession session2,@RequestParam("j_username") String name) {
  
          session2.setAttribute("name", name);
          Session session=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory().openSession();
          String hql = "SELECT E.firstName FROM User E";
          Query query = session.createQuery(hql);
          List results = query.list();
  
          //System.out.println(results.get(1).getClass().getFields());
          HashMap model = new HashMap();
          model.put("users", results);
          return new ModelAndView("search", model);
      }
  </code></pre>
  
  <p>Please help..thanx in advance..</p>