Java & J2EE Page 7 - The JSP Files (part 1): Purple Pigs In A Fruitbasket |
If you've used C before, you're probably already familiar with the "include" directive that appears near the beginning of every C program. JSP supports an equivalent include() function, which does much the same thing. Take a look at this simple example:
[thought.html]
In this case, JSP will automatically read the contents of the file "thoughts.html", and display a composite page which looks like this:
A very useful and practical application of the include() function is to use it to include a standard footer or copyright notice across all the pages of a Web site, like this:
where "footer.html" contains
Now, this footer will appear on each and every page that contains the include() statement above - and, if you need to change the message, you only need to edit the single file named "footer.html"! And that's about it for this week. We've shown you the basic building blocks of JSP, and next time, we'll be using those fundamental concepts to demonstrate JSP's control structures. Don't miss it!
blog comments powered by Disqus |