Kim wants to configure his email address in the DD, not hard-code it inside the servlet class

image with no caption

Here’s what Kim does not want in his servlet:

PrintWriter out = response.getWriter();
out.println("blooper@wickedlysmart.com");

Note

Hard-coding the address is BAD!

What happens when his email changes? He’ll have to recompile...

He’d much rather put his email address in the Deployment Descriptor (web.xml file) so that when he deploys his web app, his servlet can somehow “read” his email address from the DD. That way, he won’t have to hard-code his address in the servlet class, and to change his email he modifies only the web.xml file, without having to touch his servlet source code.

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.