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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.