Showing posts with label Basic Lesson 5:-Mixing Scriptlets and HTML in jsp. Show all posts
Showing posts with label Basic Lesson 5:-Mixing Scriptlets and HTML in jsp. Show all posts

Thursday, August 22, 2013

Basic Lesson 5:-Mixing Scriptlets and HTML in jsp

We have already seen how to use the "out" variable to generate HTML output from within a scriptlet.  For more complicated HTML, using the out variable all the time loses some of the advantages of JSP programming.  It is simpler to mix scriptlets and HTML.
Suppose you have to generate a table in HTML.  This is a common operation, and you may want to generate a table from a SQL table, or from the lines of a file.  But to keep our example simple, we will generate a table containing the numbers from 1 to N.  Not very useful, but it will show you the technique.

Here is the JSP fragment to do it: