CHAPTER 2: Building Web Applications Using Servlets and JSP 83
We will create two JSPs, shown in Listing 2-21 and Listing 2-22, to illustrate the use of the
Listing 2-21. main.jsp
1.
2.
3.
4.
5.<%out.print("Inside main.jsp"); %>
6.
7.
8.
Line 6: Uses the <jsp:include> to include the target JSP page (sub.jsp)
Listing 2-22. sub.jsp
1.
2.
3.
4.
5.<%out.print("Inside sub.jsp"); %>
6.
7.
Figure 2-28 shows the output when main.jsp is accessed.
Figure 2-28. Using the
The
The
page, a JSP page, or a servlet. The syntax for the action is as follows:
We will use the two JSPs created in the previous section to illustrate the use of the
action as illustrated in the Listing 2-23 and 2-24.