Struts-config não chama referencia tiles

2 respostas
fsalex

Pessoal,

Estou trabalhando no ambiente struts + jboss e quero colocar tiles mas estou com um problema muito grande.

Eu estou colocando toda a configuração só que que esta me gerando um erro:

HTTP Status 404 - /vosprepaid-web/vos.tiles.home


type Status report

message /vosprepaid-web/vos.tiles.home

description The requested resource (/vosprepaid-web/vos.tiles.home) is not available.

que não encontrou o arquivo, mas no caso aqui não seria o arquivo direto e sim o que esta no tiles-defs

Vou colocar abaixo as minhas configurações se alguem souber de algo fico muito grato.

Tiles-defs:

<?

<!

xml version="1.0" encoding="ISO-8859-1"?>DOCTYPE tiles-definitions PUBLIC

"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"

"http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">

<!-- Definitions for Tiles documentation -->


<

tiles-definitions>

<!-- ================================================================== -->


<!-- Definicao de templates -->

<!-- ================================================================== -->


<!-- Template default da aplicacao -->

 


<definition name="vos.tiles.default" path="/WEB-INF/jsp/template/default.jsp">

<put name="title" value="Titulo" />

<put name="menu" value="/WEB-INF/jsp/templates/menu.jsp" />

<put name="vos.tiles.corpo" type="page"/>

<put name="vos.tiles.rodape" type="page"/>

</definition>



<definition name="vos.tiles.home" extends="vos.tiles.default">

<put name="menu" value="/WEB-INF/jsp/templates/menu.jsp" />

<put name="title" value="Titulo da Home" />

<put name="vos.tiles.corpo" value="/WEB-INF/jsp/home/index.jsp"/>

</definition>

 

 

</

Struts-config:

<?

xml version="1.0" encoding="ISO-8859-1" ?>

<!

DOCTYPE struts-config PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"

"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<

struts-config>


<!-- Form Beans -->

<form-beans>

<form-bean name="testeForm" type="br.com.teste.form.TesteForm"/>

</form-beans>


<!-- Global Exceptions -->

<global-exceptions>


</global-exceptions>


<!-- Action Mappings -->

<action-mappings>



<action path="/home" forward="/vos.tiles.home" />






<action path="/index" type="br.com.teste.action.TesteAction" parameter="method" name="testeForm" scope="request">

<forward name="success" path="/WEB-INF/home/index.jsp"/>

</action>



</action-mappings>


<!-- Message Resources -->

<message-resources parameter="br.com.teste.resources.ApplicationResources"/>






<plug-in className="org.apache.struts.tiles.TilesPlugin"> <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" /> <set-property property="moduleAware" value="true" /> </plug-in> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">

<set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>

</plug-in>



</

struts-config>

Templates/default.jsp

<!

DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@

page language="java" contentType="text/html; charset=ISO-8859-1"

<%@

<%@

<%@

<%@

<%@

pageEncoding="ISO-8859-1"%> taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %> taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %> taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %> taglib uri="/WEB-INF/tld/struts-tiles.tld" prefix="tiles" %>

<

<

tiles:importAttribute scope="request"/>html>

<!-- Mirrored from www.kumpow.com/index-6.html by HTTrack Website Copier/3.x [XR&CO'2005], Wed, 03 May 2006 21:56:48 GMT -->

<

head>

<

<

meta http-equiv="content-type" content="text/html; charset=UTF-8">title>OptionOne</title>

<

<

script type="text/javascript" src="/WEB-INF/js/funcoes.js"></script>link href="/WEB-INF/css/style.css" rel="stylesheet" type="text/css">

</

head>

<

body>

<table width="100%" style="height:770px" border="0" cellspacing="0" cellpadding="0" align="center">

<tr>

<td width="50%" style="background-image: url(/WEB-INF/images/t-dr.gif); background-repeat: repeat-x; background-position: top right;height:770px" valign="top"></td>

<td width="766" style="height:770px" valign="top">

<table width="766" style="height:770px" border="0" cellspacing="0" cellpadding="0">

<tr>


<tiles:insert page="/WEB-INF/templates/menu.jsp" flush="true"/>


</tr>

<tr>

<td width="766" style="height:176px" valign="top">

<table width="766" style="height:176px" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="21" style="height:176px" valign="top"></td>

<td width="725" style="background-image: url(/WEB-INF/images/fl.jpg); background-repeat: no-repeat; height:176px" valign="top">



<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"

width="725" height="176">

<param name="movie" value="flash/header641a.swf?button=0"> 

<param name="quality" value="high">

<param name="menu" value="false">-->

<!-- Animação 

<!--[if !IE]> <-->


<object data="flash/header641a.swf?button=0"

width="725" height="176" type="application/x-shockwave-flash">

<param name="quality" value="high">

<param name="menu" value="false">

<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">

FAIL (the browser should render some flash content, not this).

</object>-->

<!-- Animação 

<!--> <![endif]-->

</object>-->

<!-- Animação 






</td>

<td width="20" style="height:176px" valign="top"></td>

</tr>

</table>

</td>

</tr>

<tr>

<td width="766" style="height:16px" valign="top"><img alt="" border="0" src="/WEB-INF/images/line.gif" style="margin-left:20px; margin-top:4px"></td>

</tr>

<tr>

<td width="766" style="height:456px" valign="top">







<!-- Conteudo -->


<tiles:get name="vos.tiles.corpo"/>







</td>

</tr>

<tr>

<td width="766" style="height:23px" valign="top"></td>

</tr>

<tr>

<td width="766" style="height:3px" valign="top"><img alt="" border="0" src="images/line1.gif" style="margin-left:20px; "></td>

</tr>

<tr>

<td width="766" style="height:28px" valign="top">

<table width="766" style="height:28px" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="21" style="height:28px" valign="top"></td>

<td width="725" style="background-image: url(images/b-dr.gif); background-repeat: repeat-y; height:28px" valign="top">

<table width="100%" style="background-image: url(images/b-t.gif); background-repeat: no-repeat; background-position: top;height:100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="100%" style="background-image: url(images/b-b.gif); background-repeat: no-repeat; background-position: bottom;height:100%" valign="top">

<div class="ls_text" style="margin-left:132px; margin-top:9px; margin-right:10px; margin-bottom:5px"><a href="index-2.html" class="ls_text">Tela</a>&nbsp; &nbsp; &nbsp;<span style="color:#51B3FF; ">|</span>&nbsp; &nbsp; &nbsp;<a href="index-1.html" class="ls_text">Suporte</a>&nbsp; &nbsp; &nbsp;<span style="color:#51B3FF; ">|</span>&nbsp; &nbsp; &nbsp;<a href="index-3.html" class="ls_text">Contato</a>&nbsp; &nbsp; &nbsp;<span style="color:#51B3FF; ">|</span>&nbsp; &nbsp; &nbsp;<a href="index-7.html" class="ls_text">Duvidas</a>&nbsp; &nbsp; &nbsp;<span style="color:#51B3FF; ">|</span>&nbsp; &nbsp; &nbsp;<a href="index-4.html" class="ls_text">Novidades</a></div>

</td>

</tr>

</table>

</td>

<td width="20" style="height:28px" valign="top"></td>

</tr>

</table>

</td>

</tr>

<tr>

<td width="766" style="height:57px" valign="top">

<div class="c_text" style="margin-left:221px; margin-top:15px; margin-right:50px; margin-bottom:15px">OptionOne.Com &copy; 2009. All Rights Reserved&nbsp; &nbsp; |&nbsp; &nbsp; <a href="index-6.html" class="c1_text">Privacy Policy</a></div>

</td>


</tr> </table>

</td>

<td width="50%" style="background-image: url(images/t-dr.gif); background-repeat: repeat-x; background-position: top;height:770px" valign="top"></td>

</tr>

</

</table>body>

<!-- Mirrored from www.kumpow.com/index-6.html by HTTrack Website Copier/3.x [XR&CO'2005], Wed, 03 May 2006 21:56:48 GMT -->

</

web.xml

<?

xml version="1.0" encoding="UTF-8"?>

<

web-app id="WebApp_ID" version="2.2"

xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">


<display-name>teste-web</display-name>




<servlet>

<servlet-name>action</servlet-name>

- Struts1.0.x: ActionComponentServlet

- Struts1.1: ActionServlet

- no Struts: TilesServlet

-->




<!-- Specify servlet class to use: <!-- <servlet-class>org.apache.struts.tiles.ActionComponentServlet</servlet-class> --> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <!-- <servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class> -->

<init-param>

<param-name>config</param-name>

<param-value>/WEB-INF/struts-config.xml</param-value>

</init-param>


<init-param>

<param-name>debug</param-name>

<param-value>2</param-value>

</init-param>

<init-param>

<param-name>detail</param-name>

<param-value>2</param-value>

</init-param>

<init-param>

<param-name>validate</param-name>

<param-value>true</param-value>

</init-param>

<load-on-startup>2</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>

<welcome-file-list>

<welcome-file>index.html</welcome-file>

<welcome-file>index.htm</welcome-file>

<welcome-file>index.jsp</welcome-file>

<welcome-file>default.html</welcome-file>

<welcome-file>default.htm</welcome-file>

<welcome-file>default.jsp</welcome-file>

</welcome-file-list>

<jsp-config>

<taglib>

<taglib-uri>/WEB-INF/tld/struts-bean.tld</taglib-uri>

<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/WEB-INF/tld/struts-html.tld</taglib-uri>

<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/WEB-INF/tld/struts-tiles.tld</taglib-uri>

<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>

</taglib>


</jsp-config>



</

home.jsp

<!

DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@

page language="java" contentType="text/html; charset=ISO-8859-1"

<%@

<%@

<%@

<%@

pageEncoding="ISO-8859-1"%> taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %> taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %> taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>

<

<

<

<

<

<

</

<

html:form action="index.do">html:hidden property="method" value="find" />head>title>index</title>meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">meta name="GENERATOR" content="Rational Application Developer">head>body>

<bean:message key="label.nome"/>: <html:text property="nome"/><html:submit value="Enviar"></html:submit>


<c:forEach items="${lista}" var="lista">

<c:out value="${lista.nome}">c:out>

</c:forEach>


<br></br>


<c:forEach begin="1" end="10">

<c:out value="aaa">c:out>

</c:forEach>


<

</<br></br>c:out value="${testeForm.nome}">c:out> 
<

c:choose>

<c:when test="${testeForm.nome == 'aa'}">
aa



</c:when>

<c:otherwise>
body content


</

</c:otherwise>c:choose>


</

</

Muito Obrigado

2 Respostas

ignacio83

Aponte para o nome que vc deu no tiles, não coloque a barra na frente:

O correto seria:

<action path="/home" forward="vos.tiles.home" />
fsalex

è isso mesmo deu certo…Vlw

Criado 24 de julho de 2009
Ultima resposta 24 de jul. de 2009
Respostas 2
Participantes 2