|
-
April 22nd, 2012, 11:27 PM
#1
jsp Exception error
i am having a problem with the continue button when i don't enter anything in the text field i get an error "org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 18" i know something is wrong with my exceptions but i am not sure what .
please help .
<%@ 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.println("Error!");}
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>
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|