Problema Include

0 respostas
manjubex

Galera, estou com problema no Include JSP. Eu tenho 2 páginas (inicio e clienteLista), onde ambas importar um cabeçalho, cada uma em uma pasta, views e views/cliente, respectivamente. Na inicio tudo beleza, ela carrega a imagem do cabeçalho e direciona os links corretamente. Porém quando eu entro na clienteLista que começa o problema, pois ele tenta achar as referencias dentro da pasta cliente.
Queria deixar as referencias com endereço absoluto.

Segue código:
Inicio.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!--Estilo css da tabela-->
<link rel="stylesheet" href="css/tabela.css" media="screen" />

<!--Corrigindo caracteres especiais-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title><fmt:message key="title.inicio"/></title>
</head>

<body>
<c:import url="cabecalho.jsp" />
<jsp:include page="cabecalho.jsp" flush="true" />

<ul>
	<li><fmt:message key="cliente"/>
	<ul>
		<li><a href="cliente/clienteCadastrar.jsp"><fmt:message key="cliente.cadastrar"/></a></li>
		<li><a href="cliente/clienteLista.jsp"><fmt:message key="cliente.consultar"/></a></li>
	</ul>
	</li>
	
	<br />
	
	<li><fmt:message key="veiculo"/>

	<ul>
		<li><a href="veiculoCadastrar.jsp"><fmt:message key="veiculo.cadastrar"/></a></li>
		<li><a href="veiculoLista.jsp"><fmt:message key="veiculo.consultar"/></a></li>

	</ul>
	</li>
	
	<br />
	
	<li><fmt:message key="locacao"/>


	<ul>
		<li><a href="locacaoCadastrar.jsp"><fmt:message key="locacao.cadastrar"/></a></li>
		<li><a href="locacaoLista.jsp"><fmt:message key="locacao.consultar"/></a></li>

	</ul>
	</li>
</ul>

<c:import url="rodape.jsp"/>
</body>
</html>

cabecalho.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>


<html>
<head>
<style>
a {
	font-size: 14px;
}
</style>
</head>

<!--Estilo css da tabela-->
<body>
	<img src="imagens/camaro.jpg" />
	
	<hr />
	
<a href="../inicio.jsp"><fmt:message key="inicio"/></a> || 
<a href="clienteCadastrar.jsp"><fmt:message key="cliente.cadastrar"/></a> ||
<a href="clienteLista.jsp"><fmt:message key="cliente.consultar"/></a> ||

<a href="veiculoCadastrar.jsp"><fmt:message key="veiculo.cadastrar"/></a>||
<a href="veiculoLista.jsp"><fmt:message key="veiculo.consultar"/></a> ||
	
<a href="locacaoCadastrar.jsp"><fmt:message key="locacao.cadastrar"/> </a>||
<a href="locacaoLista.jsp"><fmt:message key="locacao.consultar"/></a> 	||

	<hr />
	<hr />
	<br />
</body>
</html>

clienteLista.jsp

<!doctype html>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<html>
<head>
<!--Importa JSTL-->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 

<!--Importa minhas tags-->
<%@taglib tagdir="/WEB-INF/tags" prefix="bruno"%> 

<title><fmt:message key="title.lista.cliente"/></title>

<!--Corrige problemas de leitura-->
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">

<!--Carrega as Jquery's-->
<script src="js/jquery.js"></script>
<script src="js/jquery.tablesorter.min.js"></script>
<script src="js/jquery.tablesorter.pager.js"></script>

<script>
function envia() {
	if (confirm('Excluir cliente?'))
document.cliente.submit();
}
</script>

<!--Estilo css da tabela-->
<link rel="stylesheet" href="css/tabela.css" media="screen" />

</head>

<body>
<!--Importando cabecalho-->
<c:import url="../cabecalho.jsp"/>
<jsp:include page="../cabecalho.jsp" flush="true" />


<!--Javabean para criar ClienteDAO-->
<jsp:useBean id="dao" class="projeto.dao.ClienteDAO" />

Pesquisar: <input type="text" id="pesquisar" name="pesquisar"> <br><br>

<table summary="lista clientes" border="1">
	<thead>
		<tr>
			<th>codigo</th>
			<th>nome</th>
			<th>email</th>
			<th>endereco</th>
			<th>telefone</th>
			<th>abrir</th>
			<th>alterar</th>
		</tr>
	</thead>
	
	<tbody>
<!--loop que pega lista clientes e preenche tabela-->
		<c:forEach var="cliente" items="${dao.lista}">
			<tr>
				<td>${cliente.codigo}</td>
				<td>${cliente.nome}</td>
				
				<!--Checa se tem e-mail-->
				<td><c:if test="${not empty cliente.email}">
					<a href="mailto:${cliente.email}">${cliente.email}</a>
				</c:if> <c:if test="${empty cliente.email}">
						E-mail não informado
					</c:if></td>
					
				<td>${cliente.endereco}</td>
				<td>${cliente.telefone1}</td>
				
				<td><a href="mvc?logica=ClienteLogica&metodo=consulta&codigo=${cliente.codigo}">abrir</a></td>
				<td><a href="mvc?logica=ClienteLogica&metodo=popula&codigo=${cliente.codigo}"><img src="imagens/edit.png"></img></a></td>
			</tr>
		</c:forEach>
	</tbody>
</table>
<BR />
<BR />
<BR />
<BR />


<!--Barra de páginas-->

<div id="pager" class="pager">
<form><span> Exibir <select class="pagesize">
	<option selected="selected" value="10">10</option>
	<option value="20">20</option>
	<option value="30">30</option>
	<option value="40">40</option>
</select> Registros </span>

 <img src="imagens/first.png" class="first" />
 <img src="imagens/prev.png" class="prev" />
 
 <input type="text" class="pagedisplay" size="3"/>
 <img src="imagens/next.png" class="next" />
 <img src="imagens/last.png" class="last" />
 
 </form>
 </div>
 
<script>

    $(function(){
      
      $('table > tbody > tr:odd').addClass('odd');
      
      $('table > tbody > tr').hover(function(){
        $(this).toggleClass('hover');
      });

      
      $('#pesquisar').keydown(function(){
        var encontrou = false;
        var termo = $(this).val().toLowerCase();
        $('table > tbody > tr').each(function(){
          $(this).find('td').each(function(){
            if($(this).text().toLowerCase().indexOf(termo) > -1) encontrou = true;
          });
          if(!encontrou) $(this).hide();
          else $(this).show();
          encontrou = false;
        });
      });
      
      $("table") 
        .tablesorter() 
        .tablesorterPager({container: $("#pager")})
        .bind('sortEnd', function(){
          $('table > tbody > tr').removeClass('odd');
          $('table > tbody > tr:odd').addClass('odd');
        });
      
    });

    </script>
 

<br>
<br>
<br>
<br>
<!-- importando rorape-->
<c:import url="../rodape.jsp"/>

</body>
</html>
Criado 10 de agosto de 2012
Respostas 0
Participantes 1