- This topic has 0 replies, 1 voice, and was last updated 14 years, 8 months ago by damien_avoce.
-
AuthorPosts
-
damien_avoceMemberHi everybody,
I am using Myeclipse 8.0 on linux (all in one installed). I cannot make insert work for attributes and definitions. No error was shown on compilation. The jsp file “mainlayout” is not showing the header, footer and body. Am I missing something? Here are my files:
Thanksweb.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE web-app PUBLIC
“-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN”
“http://java.sun.com/dtd/web-app_2_3.dtd”>
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>chainConfig</param-name>
<param-value>org/apache/struts/tiles/chain-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping> <servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping><welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list></web-app>
============= ==========
struts-config
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE struts-config PUBLIC “-//Apache Software Foundation//DTD Struts Configuration 1.3//EN”
“http://struts.apache.org/dtds/struts-config_1_3.dtd”><struts-config>
<form-beans />
<global-exceptions />
<global-forwards />
<action-mappings />
<message-resources parameter=”com.fallergroup.struts.ApplicationResources” /><plug-in className=”org.apache.struts.tiles.TilesPlugin”>
<set-property property=”definitions-config”
value=”/WEB-INF/tiles-defs.xml”/>
</plug-in></struts-config>
=============
mainlayout.jsp
<%@ taglib uri=”http://struts.apache.org/tags-tiles” prefix=”tiles” %>
<h1>I am the main layout</h1>
<table border=”1″ width=”100%” cellspacing=”5″>
<tr><td colspan=”2″>A<tiles:insert attribute=”header” flush=”true”/></td></tr>
<tr>
<td width=”20%”>a<tiles:insert attribute=”header” flush=”true”/></td>
<td
width=”80%”>b<tiles:insert attribute=”header” flush=”true”/></td>
</tr>
<tr><td colspan=”2″>B<tiles:insert attribute=”footer” flush=”true”/></td></tr>
</table>
===============tiles-defs.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE tiles-definitions PUBLIC
“-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN”
“http://struts.apache.org/dtds/tiles-config_1_3.dtd”>
<tiles-definitions><definition name=”main.layout” path=”/jsp/mainLayout.jsp”>
<put name=”title” value=””/>
<put name=”header” value=”/jsp/header.jsp” />
<put name=”menu” value=”/menu/menu.jsp”/><!–navigation.do” />–>
<!– <put name=”menu” value=”/menu/menu.layout” />–>
<put name=”body” value=”/welcome.jsp” />
<put name=”footer” value=”/jsp/footer.jsp” />
</definition><!– Tiles Definition of welcome page –>
<!– <definition name=”menu.index” path=”/menu/menu.jsp”>
<put name=”title” value=”Welcome page” />
<put name=”body” value=”/index.jsp” />
</definition>–>
<definition name=”index” extends=”main.layout”>
<put name=”title” value=”Index Page” />
<!– <put name=”managerLogin” value=”/login/managerLogin.jsp” />–>
<put name=”body” value=”/welcome.jsp” />
</definition>
</tiles-definitions>
==========================
header.jsp
<%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
%><%@ taglib uri=”http://struts.apache.org/tags-bean” prefix=”bean” %>
<%@ taglib uri=”http://struts.apache.org/tags-html” prefix=”html” %>
<%@ taglib uri=”http://struts.apache.org/tags-logic” prefix=”logic” %>
<html> <head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>CDI Project</title>
</head>
<body>
<h1>This the header</h1>
</body>
</html> -
AuthorPosts