P
P
Pavel Peskov2016-12-01 00:52:40
JSF
Pavel Peskov, 2016-12-01 00:52:40

How to include template in jsf 2?

Hello, please tell me how to include a template in jave server faces:
prelogin.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="" />
    <link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="css/bootstrap-theme.css" type="text/css" />
    <script src="js/jquery-2.1.1.min.js"></script>  
    <script src="js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="css/font-awesome.css"/>
    <link rel="stylesheet" href="css/checkradio.css"/>   	
</h:head>

<h:body class="common-styles">
    
    <ui:insert name="navbar">
    </ui:insert>

    <div class="cabinet-page logout-page">
      <div class="cabinet-breadcrumbs">
        <div class="image-wrap"><img src="images/title-bg.jpg"/></div>
        <div class="container">
          <ol class="breadcrumb">
            <li><a href="#">Главная</a></li>
            <li class="active">Вступить в ТКС Бонус</li>
          </ol>
          <div class="page-header">
            <div class="row">
              <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1 col-sm-12 col-xs-12">
                <h1>Вступить в ТКС Бонус</h1>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="panel-footer">
      <nav class="navbar navbar-bottom-menu hidden-xs">
        <div class="container">
          <div class="row">
            <div class="hidden-sm col-md-3 right-aligned">
              <div class="phone-wrap">
                <div class="phone">8 800 100 93 99</div>
                <a href="#">Звонок России бесплатно</a>
              </div>
            </div>
            <div class="col-sm-3 col-md-2">
              <a href="#" class="navbar-link">Информация</a>
              <ul class="nav">
                <li><a href="#">О нас</a>
                  <ul class="nav subnav">
                    <li><a href="#">ТКС История</a></li>
                    <li><a href="#">Новости</a></li>
                    <li><a href="#">Офисы и представительства</a></li>
                    <li><a href="#">Вакансии</a></li>
                    <li><a href="#">Контакты</a></li>
                  </ul>
                </li>
                <li><a href="#">Правила перевозок</a></li>
                <li><a href="#">Страхование</a></li>
              </ul>
            </div>
            <div class="col-md-2 col-sm-3">
              <a href="#" class="navbar-link">Вагоны и услуги</a>
              <ul class="nav">
                <li><a href="#">Виртуальный тур</a></li>
                <li><a href="#">Классы обслуживани</a></li>
                <li>
                  <a href="#">В пути</a>
                  <ul class="nav subnav">
                    <li><a href="#">Еда и напитки</a></li>
                    <li><a href="#">Развлечения</a></li>
                    <li><a href="#">Мобильный кинотеатр</a></li>
                    <li><a href="#">Для детей</a></li>
                    <li><a href="#">Предзаказ</a></li>
                  </ul>
                </li>
              </ul>
            </div>
            <div class="col-md-2 col-sm-3">
              <a href="#" class="navbar-link">Билеты и скидки</a>
              <ul class="nav">
                <li><a href="#">Где купить билет?</a></li>
                <li><a href="#">Наши маршруты</a></li>
                <li><a href="#">Акции и скидки</a></li>
              </ul>
            </div>
            <div class="col-md-2 col-sm-3">
              <a href="#" class="navbar-link">Корпоративным<br/>клиентам</a>
              <a href="#" class="navbar-link">ТКС Бонус</a>
            </div>
          </div>
        </div>
      </nav>
      <div class="copyright"><a href="#">© 2015 - 2016, ТрансКлассСервис</a></div>
    </div>
  
</h:body>
</html>

log.xhtml
<ui:composition 
      template="WEB-INF/layout/prelogin.xhtml"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">
      <ui:define name="navbar">
        <nav class="navbar navbar-top-menu navbar-fixed-top">
          <div class="panel profile">
            <div class="container">
              <div class="navbar-nav navbar-right">
                <button type="button" class="btn">Вход</button>
                <button type="button" class="btn">Регистрация</button>
              </div>
            </div>
          </div>
          <div class="menu-row">
            <div class="container">
              <div class="navbar-nav"><a href="#" class="logo"><img src="images/logo.png"/></a></div>
              <ul class="nav navbar-nav hidden-sm hidden-xs">
                <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><div class="text">Вагоны и<br/>услуги</div><div class="caret"></div></a>
                  <ul class="dropdown-menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                  </ul>
                </li>
                <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><div class="text">Билеты и<br/>скидки</div><div class="caret"></div></a>
                  <ul class="dropdown-menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                  </ul>
                </li>
                <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><div class="text">Корпоративным<br/>клиентам</div><div class="caret"></div></a>
                  <ul class="dropdown-menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                  </ul>
                </li>
                <li><a href="#">Информация</a></li>
                <li><a href="#">ТКС Бонус</a></li>
              </ul>
              <div class="navbar-nav navbar-right">
                <div class="phone-wrap">
                  <div class="phone">8 800 100 93 99</div>
                  <a href="#" class="js-open-reg">Звонок России бесплатно</a>
                </div>
                <button type="button" class="btn hidden-xs">Поиск билета</button>
              </div>
            </div>
          </div>
        </nav>        
      </ui:define>  
</ui:composition>

for some reason this code is not working

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question