How it runs...

The first time you request the Hello.jsp, the JSP does the conditional test, discovers there’s no value for userName, and forwards to the HandleIt.jsp. Assuming the user types a name into the name input field, the second request won’t do the forward, since the userName request parameter has a non-null value.

First request for Hello.jsp

image with no caption

Second request for Hello.jsp

image with no caption
image with no caption

How come the “Welcome to our page!” text didn’t print out the first time?

Get Head First Servlets and JSP, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.