<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>

 <f:view>
 <head>
    <title>JSF Library Home Page</title>
    <link rel="stylesheet" type="text/css" href='<%= request.getContextPath() + "/css/app.css" %>'>
 </head>
 <body>
    <h:form>
    <h1>JSF Library</h1>
    <hr>
    Welcome to the JSF library.
    <p>
    <h:outputText value="You are logged in as: #{usersession.currentUser.username}"/>
    <p>
    <h:commandButton action="viewbooks"  value="View Books"/>
    <h:commandButton action="addbook" rendered="#{usersession.currentUser.librarian}" value="Add Book"/>
    <h:commandButton action="adminbooks" rendered="#{usersession.currentUser.librarian}" value="Book Administration"/>
    <hr>
    <h:commandLink rendered="#{not usersession.loggedIn}" action="login">
        <h:outputText value="Log In"/>
    </h:commandLink>
    <h:commandLink rendered="#{usersession.loggedIn}" action="#{usersession.logout}">
        <h:outputText value="Log Out"/>
    </h:commandLink>

    </h:form>
 </body>
</f:view>
<html>
