Depending on the current screen ID obtained from the ScreenManager , the proper Template object will be created and the parameters will be set to reflect the appropriate page components. The Template object is processed by the JSP templating mechanism illustrated in Code Example 4.1 . Notice that expressions within the tag parameters are used to interact with sample application data. When designing a Web site with interactive and dynamic content, it may be necessary to use small portions of code to generate content. Scriptlets are small fragments of scripting code whose language is defined by the language parameter in the JSP page directive.
Expressions are like scriptlets, except that they are played directly in the response.
To make code easier to read and maintain, we recommend that JSP pages be used mainly for presentation. While a major portion of an application could be developed in JSP technology, placing large amounts of code in JSP pages makes them more difficult to update and can be confusing to page designers. We recommend including Java code only when necessary. JavaBeans components and custom tags provide a means of adding functionality while avoiding scriptlets. A developer can use expressions with JavaBeans components or custom tags to generate dynamic content.