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.


<!-- directive tag -->
<%! String username;
    int number1 = 0;

 <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" />

if (request.getParameter("submit") != null) {
    username = request.getParameter("usernameField");
    number1 = Integer.parseInt(request.getParameter("ageField"));
    out.print("answer" + number1);


ops i just figue it out.

i just had question, how do i see if number1 is null.
i was thinking number == 0 but thats not null. its zero.

int number1 = Integer.parseInt(request.getParameter("ageField"));

i tried this but non of them works:

  if(request.getParameter("ageField") == null)
   if(number = null)
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.