title: An exception occurred processing JSP page, line points to startsWith() method
body: <p>I have the following code in my JSP:</p>
  
  <pre><code>String name=request.getParameter("name");
  
  if(name.startsWith("315")){
          query="select pass from students where regno='"+name+"'";
          url1="marks.jsp";
      }
  else{
          query="select pass from staff where name='"+name+"'";
          url1="staff.jsp";
      }
  </code></pre>
  
  <p>When I run this JSP, I get a HTTP 500 error page:</p>
  
  <pre><code>org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 35
  
  32:         String url1="";
  33:         if(name!="")
  34:         {
  35:         if(name.startsWith("315")){
  36:             query="select pass from students where regno='"+name+"'";
  37:             url1="marks.jsp";
  38:         }
  
  
  Stacktrace:
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  </code></pre>
  
  <p>How is this caused and how can I solve it?</p>