But wait ! It gets even better...

And all you have to do is make sure your form input field name (which becomes the request parameter name) is the same as the property name in your bean. Then in the <jsp:setProperty> tag, you don’t have to specify the param attribute. If you name the property but don’t specify a value or param, you’re telling the Container to get the value from a request parameter with a matching name.

If we change the HTML so that the input field name matches the property name:

image with no caption

We get to do THIS

image with no caption

Note

If the request parameter name matches the bean property name, you don’t need to specify a value in the <jsp:setProperty> tag for that property.

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.