Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't convert String to Integer
    primarykey
    data
    text
    <p>I am a beginner. I know this is basic. In my project I am using Java and MySQL workbench. I am reading a data from user by using select box which is coming from database by using ajax. The code for select box is mentioned below</p> <pre><code>&lt;% String a =request.getParameter("course"); if(a!=null) { ResultSet rs=s.selectsub(a); String Query="select * from subject where course_id='"+a+"'"; %&gt; &lt;select name="subject" id="subject"&gt; &lt;option&gt;Select Subject&lt;/option&gt; &lt;% while(rs.next()) { %&gt; &lt;option value="&lt;% out.println(rs.getString("subject_id")); %&gt;"&gt; &lt;% out.println(rs.getString("subject")); %&gt;&lt;/option&gt; &lt;% } %&gt; &lt;/select&gt; &lt;% } %&gt; </code></pre> <p>and the subject id is passed to another page using post method and trying this code</p> <pre><code> String subject=request.getParameter("subject"); int subjectid=Integer.parseInt(subject); </code></pre> <p>But the line Integer conversion is not working. Error is showing. The error is</p> <pre><code>org.apache.jasper.JasperException: An exception occurred processing JSP page /saveuser.jsp at line 29 26: String email=request.getParameter("email"); 27: String designation=request.getParameter("designation"); 28: String subject=request.getParameter("subject"); 29: int subjectid=Integer.parseInt(subject); 30: String institute=request.getParameter("institute"); 31: String inemail=request.getParameter("inemail"); 32: String uname=request.getParameter("uname"); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload