The code I have attached should throw an exception (using Integer.parseInt) when a none numerical value is entered and therefore display a message but it doesn't even though I enter things like too many and uikehfkjsdhiwefd.
 
Any suggestions on this would be helpful.
 
 
public void process (ServletContext sc, HttpServletRequest request, HttpServletResponse repsone)
  throws IOException, ServletException
 {
  String project = request.getParameter("project");
  if (project.equals(""))
  {
   throw new IOException("Project must must not be empty!");
  }
  String hours = request.getParameter("hours");
  try
  {
   Integer.parseInt(hours);
  }
  catch (NumberFormatException e)
  {
   e.printStackTrace();
   throw new IOException("Hours must be an Integer! hours = " + hours);
  }
  Debug.log (this, "process", "");
 }
 
==========================================================================To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to