Put a default content in JSP layout

1

I'm trying to create views using a layout in , this is my layout :

/WEB-INF/tags/layouts/layout.tag

<%@tag description="Layout de las paginas" pageEncoding="UTF-8"%>
<%@attribute name="title" fragment="true" %>
<html lang="es">

<head>
<title> 
    <jsp:invoke fragment="title" />
</title>
</head>

<jsp:doBody></jsp:doBody>

</html>

and I use it in my views like this:

<%@taglib prefix="t" tagdir="/WEB-INF/tags/layouts" %>
<t:layout>
    <jsp:attribute name="title"> Página principal </jsp:attribute>
    <jsp:body>
        Hola, Esta es la página principal
    </jsp:body>
 </t:layout>

My question is if I do not provide in my view the j sp:attribute like this:

<%@taglib prefix="t" tagdir="/WEB-INF/tags/layouts" %>
<t:layout>
    <jsp:body>
        Hola, Esta es la página principal
    </jsp:body>
</t:layout>

in the title of the page appears

  

localhost: 8000 / homepage

Is there a way to place a default content in Layout when the fragment title is not provided?

    
asked by Horacio Sanchez 30.06.2016 в 20:20
source

0 answers