i get an error "org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 18" i think my exception code is wrong. i don't know how to return an empty string when the user doesn't enter any number and clicks "continue". any suggestions

<%@ page import="java.io.*"%><%@
page import="java.util.*"%><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<%
    String sum = (String) session.getAttribute("sum");

            sum = "5";
            session.setAttribute("sum",sum);

    int isum = Integer.parseInt(sum);
    try {
    isum=Integer.parseInt(request.getParameter("number"));
    } catch (NumberFormatException nfe) {out.print(" ")}      
    if(request.getParameter("number")!=null && Integer.parseInt(request.getParameter("number"))==isum)
    {
     if(request.getParameter("submit") != null){
            out.print("Hello");}
    }
  %>

  <body>
    <title>MAIN</title>
    <form action="index.jsp" method="post">
    Enter 5 = <input type="text" name="number">
    <input type="submit" value="continue" name="submit">
    </form>


 </body>
 </html>

Does isnum actually hold a valid value?
Does the problem happen before 18 and is just exposed there?

isum holds whatever the user enters, but when the user doesn't enter anything i get an error

I mean: When this runs, does it contain the value you expect?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.