title: passing int as parameter from JSP to servlet
body: <p>I am trying to pass studentId of datatype <strong>int</strong> to servlet but it does not accept it and forces to change the datatype to String </p>
  
  <pre><code>    int studentId;
      String studentName;
  
      studentId = request.getParameter("StudentId");   // (cannot convert from int to String).
  </code></pre>
  
  <p>I can't change it to String as in the database studentId is an integer (primary key) and my java class also takes an int as a parameter.</p>
  
  <p>How can I solve this?</p>