O'Reilly logo

Component Development for the Java™ Platform by Stuart Dabbs Halloway

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

7.5. Code Generation in JSP

JSP represents an entirely different use of code generation. JSP provides a web-content-oriented language that can include escapes to blocks of Java code. The idea is that web developers experienced with HTML and XML can design pages that have a substantial amount of static content, and then they can occasionally use escape sequences to introduce blocks of Java code. These blocks of Java code execute when the page is accessed and can add dynamic content to the page.

A JSP engine converts JSP syntax into a normal Java source file containing the code for a Java servlet, which it then compiles and executes. Listing 7-4 shows a simple Hello.jsp servlet that displays a greeting. Normal text in the page is sent directly ...

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