O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Bean tags convert primitive properties automatically

If you’re familiar with JavaBeans from any earlier lifetime, this is no surprise to you. JavaBean properties can be anything, but if they’re Strings or primitives, all the coercing is done for you.

That’s right—you don’t have to do the parsing and conversion yourself

If we make the type Employee (instead of Person)

image with no caption

It all works

image with no caption

The <jsp:setProperty> action takes the String request parameter, converts it to an int, and passes that int to the bean’s setter method for that property.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required