if i hit sumbit i get output at bottom. but if i check again than i get a error. bc number1 is null.
i was thinking to have about if statment inside if statment, to text if int field is null or not.
<html>
<body>
<!-- directive tag -->
<%! String username;
int number1 = 0;
%>
<br/><br/><br/>
<form method="post" action="index.jsp">
what's your name?<br/>
<input type="text" name="usernameField"/><br/>
what's your aga?<br/>
<input type="text" name="ageField" /><br/>
<input type="submit" name="submit" />
</form>
<%
if (request.getParameter("submit") != null) {
username = request.getParameter("usernameField");
number1 = Integer.parseInt(request.getParameter("ageField"));
out.print("answer" + number1);
}
%>
</body>
</html>