title: Passing Data from jsp to controller in Spring mvc
body: <p>I am new to Springs and I am stuck at passing data from jsp to controller 
  What i have here is a listing page where user is allowed to click on the primary key and then that primary key should pass to controller for it to detect the incoming request of the user to view the page</p>
  
  <p>I have my listing jsp as follows</p>
  
  <pre><code>    &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;style&gt;
  .tableimp {
      margin-top: 150px;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;table align="center" border="1" class="tableimp"&gt;
          &lt;tr&gt;
              &lt;th bgcolor="#2E64FE"&gt;USERNAME&lt;/th&gt;
              &lt;!--            &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt; --&gt;
              &lt;th bgcolor="#2E64FE"&gt;FIRSTNAME&lt;/th&gt;
              &lt;!--            &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt; --&gt;
              &lt;th bgcolor="#2E64FE"&gt;LASTNAME&lt;/th&gt;
              &lt;!--            &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt; --&gt;
              &lt;th bgcolor="#2E64FE"&gt;EMAIL&lt;/th&gt;
              &lt;!--            &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt; --&gt;
              &lt;th bgcolor="#2E64FE"&gt;USERID&lt;/th&gt;
          &lt;/tr&gt;
  
          &lt;c:forEach items="${stkList}" var="maps"&gt;
              &lt;tr&gt;
                  &lt;td colspan="5"&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;c:forEach items="${maps}" var="mapEntry"&gt;
                      &lt;td align="center"&gt; &lt;c:choose&gt;
                              &lt;c:when test="${mapEntry.key eq 'userId'}"&gt;
                                  &lt;c:url var="userView" value="userView.do" /&gt;
                                  &lt;a href="&lt;c:out value='userView.do?userId=${mapEntry.value}' /&gt;"&gt;${mapEntry.value}&lt;/a&gt;
                              &lt;/c:when&gt;
                              &lt;c:otherwise&gt;
                              ${mapEntry.value}
                          &lt;/c:otherwise&gt;
                          &lt;/c:choose&gt;&lt;/td&gt;
                  &lt;/c:forEach&gt;
              &lt;/tr&gt;
          &lt;/c:forEach&gt;
      &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My Controller</p>
  
  <pre><code>@RequestMapping(value="/userView.do*", method=RequestMethod.GET)
  public ModelAndView viewUser(HttpServletRequest request)
  {
      try{
          //I need that userId Here somehow 
  
      }
      catch(Exception e)
      {
          e.printStackTrace();
      }
      return new ModelAndView("form","",null);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Could anyone please give me a snippet how to achieve the task</p>
  
  <p>My url gets append to browser as i want : localhost:8080/SpringMVC/userView.do?userId=1</p>
  
  <p>I need this userId value in my controller thats it :)</p>