...can you tell me how to set this properly in a servelet
Modern JSPs should not contain any Java code (if possible even the old code should not). Move them to controller/model classes appropriately.
If you are new to web development you may want to look at the
MVC pattern.