tags:

views:

82

answers:

1

i am inclduing a header.jsp in my layout.sp but it does not get reflected in the browser and have tried both mozilla and ie even after refreshing cache..

header.jsp content---

<h1>Login Application</h1>

layout.jsp content--

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator"
    prefix="decorator"%>

<%@page contentType="text/html; charset=UTF-8"%>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />


</head>

<body>
<div>
 <jsp:include page="/WEB-INF/includes/header.jsp"/>
</div>


<div  ><decorator:body /></div>



</body>
</html>
+3  A: 

It's because it's in the WEB-INF directory.

Everything that is in the WEB-INF isn't accessible to the HTTP server. A jsp:include is called via an HTTP request to the server but the target file is something it is not allowed to serve, so you get nothing.

If you really want to use that file as is, you can use this:

 <%@ include file="/WEB-INF/includes/header.jsp" %>

as that will get evaluated at compile time and the compiler is able to access that file.

Or you could move the jsp to a file that is accessible to the web server, like /includes/ that is a sibling to WEB-INF.

<jsp:include page="/includes/header.jsp"/>

Also, make sure the file has the proper permissions so the server can access it.

seth
i have tried this as well ..but in vain!!
plz help !!!!!!!!!!!