Learn Java for Web Development

(Tina Meador) #1

194 CHAPTER 4: Building a Web Application Using Struts 2


13.
14.


15.
16.
17.
18.
19.
20.
21.
22.
23.
24.

25.
26.


Listing 4-37 illustrates the header.jsp file.


Listing 4-37. header.jsp


1.<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2.pageEncoding="ISO-8859-1"%>
3.<%@ taglib prefix="s" uri="/struts-tags"%>
4.
5.


6.


7.BOOK
8.STORE
9.

10.


11.
12.
13.
14.Welcome |
Log out</s:if>
15.
16.Login
17.</s:else>
18.
19.
20.
21.
22.

23.
24.

25.


Lines 14 to 17 use Struts 2 s:if, s:else, and s:property tags to welcome the user when logged in
and allow the user to log out. Since this code is in the header, this functionality will be available to all
the pages in the application.

BOOK 8.STORE 9. 10. - Learn Java for Web Development - free download pdf - issuhub">
Free download pdf