Olá pessoal, estou utilizando o Tomcat 5.5.17 e estou com um problema na direcita : <jsp:directive.include file=""/>
Simplesmente ela não é interpretada, o arquivo que coloco para ser incluído é ignorado.
Ja verifiquei e os arquivos estão no local correto, mas não está funcionando.
Abaixo segue o código :
<?xml version="1.0" encoding="iso-8859-1"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:t="http://myfaces.apache.org/tomahawk">
<jsp:text>
<html>
<head>
<title>.:: DATASHEARCH ::.</title>
<link href="../scripts/data.css" rel="stylesheet" type="text/css"></link>
<script type="text/javascript" src="../scripts/scripts.js"></script>
<script type="text/javascript" src="../scripts/calendar1.js"></script>
<script type="text/javascript" src="../scripts/calculatorTigra.js"></script>
</head>
<body>
<table width="722" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<jsp:directive.include file="topo.jsp"/>
</table>
<table width="722" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td background="../img/barrameuback.gif"><img src="../img/nada.gif" width="10" height="23"></img>
</td>
</tr>
</table>
<table width="722" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td background="../img/fundoback.jpg"><table width="722" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table width="702" border="0" cellspacing="0" cellpadding="0" valign="top">
<tr>
<td width="100%" align="left" valign="top">
<table width="100%" height="100%" align="center" valign="top">
<tr>
<td width="180" align="left" valign="top">
<!-- CARREGA O MENU DO ADMINISTRADOR -->
<jsp:directive.include file="menuAdministrador.jsp"/>
</td>
<td width="522" align="left" valign="top">
<!-- CORPO DOS FORMULÁRIOS -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="10"><img src="../img/nada.gif" width="10" height="260"></img></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="722" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="../img/rodape.gif" width="722" height="69" border="0" usemap="#Map"></img>
</td>
</tr>
</table>
<!-- CARREGA OS MAPEAMENTOS INFERIORES -->
<jsp:directive.include file="../commons/mapeamentoBotton.jsp"/>
</body>
</html>
</jsp:text>
</jsp:root>
Se alguem tiver alguma idéia do que pode ser, eu agradeço.
<jsp:directive.include file="…/topo.jsp"/> —> sera ?
O Problema não é esse não…
O Caminho do arquivo está correto…
Estou achando que as directivas jsp não estão sendo interpretadas…
Provavelmetne tenha que baixar alguma api para incluir no projeto, mas não estou localizando a mesma…
Se alguem tiver mais alguma idéia… agradeço…
Olá vc pode usar da seguinte forma
se a sua intencao for incluir em tempo de
renderizacao, lembrando que neste caso o arquivo jsp valido ou seja com cabecalho declarado as taglibs e tal.
<f:subview id="idSub">
<jsp:include page="/test.jsp"/>
</f:subview>
exemplo de de test.jsp
<%@ page session="false" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<html>
<head>
</head>
<f:view>
<h:form>
<h:outputText value="teste"/>
</h:form>
</f:view>
</html>
caso seja em tempo de compilaçao, neste caso o arquivo deve conter apenas o trecho com tags.
<%@include file="/test.jsp"%>
exemplo de de test.jsp para o include file
<h:outputText value="teste"/>
Testei desta forma também… e não funcionou… realmente as tag libaries jsp não estão sendo interpretadas…
Tem algum jar jsp que tenho que importar para a pasta lib da minha aplicação?
Tipo, jsp.jar ou algo semelhante?
E ai pessoal? Alguem tem alguma idéia do que pode ser?
Resolvi o problema.
Mudei a forma de escrever meus arquivos… funcionou blz…
segue o exemplo :
<?xml version="1.0" encoding="iso-8859-1"?>
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<title>.:: DATASHEARCH ::.</title>
<link href="../scripts/data.css" rel="stylesheet" type="text/css"></link>
<script type="text/javascript" src="../scripts/scripts.js"></script>
<script type="text/javascript" src="../scripts/calendar1.js"></script>
<script type="text/javascript" src="../scripts/calculatorTigra.js"></script>
</head>
<body>
<!-- CARREGA TOPO -->
<ui:include src="../administracao/topo.jsp">
</ui:include>
<table width="722" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td background="../img/barrameuback.gif"><img src="../img/nada.gif" width="10" height="23"></img>
</td>
</tr>
</tbody>
</table>
<table width="722" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td background="../img/fundoback.jpg"><table width="722" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top"><table width="702" border="0" cellspacing="0" cellpadding="0" valign="top">
<tbody>
<tr>
<td width="100%" align="left" valign="top">
<table width="100%" height="100%" align="center" valign="top">
<tbody>
<tr>
<td width="180" align="left" valign="top">
<!-- CARREGA O MENU DO ADMINISTRADOR -->
<ui:include src="../administracao/menuAdministrador.jsp">
</ui:include>
</td>
<td width="522" align="left" valign="top">
<ui:insert name="body">
<!-- CORPO DOS FORMULÁRIOS -->
</ui:insert>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td width="10"><img src="../img/nada.gif" width="10" height="260"></img></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table width="722" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<img src="../img/rodape.gif" width="722" height="69" border="0" usemap="#Map"></img>
</td>
</tr>
</tbody>
</table>
<!-- CARREGA OS MAPEAMENTOS INFERIORES -->
<ui:include src="../commons/mapeamentoBotton.jsp">
</ui:include>
</body>
</html>
Abraços