Is it possible to use JSP sort of as a template without having code inside?
Values should be inserted into a hash map, and the JSP can read the values from there.
Is it possible to code like this in a GAE application, or do you need external tools/frameworks to accomplish this?
In other words, is it possible to pass values from the servlet handler to the JSP template?
Next to JSP there’s also the Servlet API.
If the map is request or session specific, then create a class which extends
HttpServletand implementdoGet()method like follows:Register the
Servletinweb.xmlon a certainurl-patternand invoke an URL matching this pattern.This way the
mapis available as${map}in JSP. Here’s an example which iterates over themapusing JSTLc:forEachtag:If the map is an application wide constant, then rather implement
ServletContextListenerand do the following incontextInitialized()method:Register the
ServletContextListenerinweb.xmlas follows:and it will be executed on webapp’s startup. The
mapis then available in JSP by${map}as well.See also: