- This topic has 2 replies, 2 voices, and was last updated 17 years, 3 months ago by Loyal Water.
-
AuthorPosts
-
rgentelaMemberHi,
I am having problem with the struts tiles. I have configured all the files like Struts-config, web.xml, created tiles-def and template.jsp but still my application does not load the tiles.I am using MyEclipse, Tomcat 6.0
please helpstruts-config.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE struts-config PUBLIC “-//Apache Software Foundation//DTD Struts Configuration 1.1//EN” “http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd”><struts-config>
<data-sources />
<form-beans >
<form-bean name=”loginForm” type=”com.arccorp.pram.form.LoginForm” />
<form-bean name=”projectMainForm” type=”com.arccorp.pram.form.ProjectMainForm” />
</form-beans>
<global-exceptions />
<global-forwards ></global-forwards><action-mappings >
<action
attribute=”loginForm”
input=”/jsp/login.jsp”
name=”loginForm”
path=”/login”
scope=”request”
type=”com.arccorp.pram.action.LoginAction”>
<forward name=”success” path=”/projectMain.do” />
<forward name=”failure” path=”/jsp/login.jsp” />
</action>
<action
attribute=”projectMainForm”
name=”projectMainForm”
path=”/projectMain”
scope=”request”
type=”com.arccorp.pram.action.ProjectMainAction”>
<forward name=”success” path=”/jsp/project_main.jsp” />
</action></action-mappings>
<message-resources parameter=”com.arccorp.pram.ApplicationResources” /><plug-in className=”org.apache.struts.tiles.TilesPlugin”>
<set-property property=”definitions-config” value=”/WEB-INF/tiles-def.xml” />
</plug-in>
</struts-config>—————————————————————————————————
web.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app version=”2.4″ 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”>
<servlet><servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.tiles.ActionComponentServlet</servlet-class>
<!–
<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>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>
<jsp-config>
<taglib>
<taglib-uri>/WEB-INF/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>—————————————————————————————
tiles-def.xml<?xml version=”1.0″ encoding=”UTF-8″?>
<xml-body><tiles-definitions>
<definition name=”siteLayoutDef” path=”/jsp/template.jsp”>
<put name=”title” type=”string”>PRAM Project</put>
<put name=”header” type=”string”>THIS IS THE HEADER”</put>
<put name=”footer” type=”string”>THIS IS THE FOOTER”</put>
<put name=”content” type=”string”>Content goes here</put>
</definition></tiles-definitions>
</xml-body>
————————————————————————-
template.jsp
<%@ page language=”java” %>
<%@ taglib uri=”/WEB-INF/struts-tiles.tld” prefix=”tiles” %>
<html><head>
<title><tiles:getAsString name=”title” ignore=”true”/></title>
</head><body>
<table border=”1″ cellpadding=”0″ cellspacing=”0″ width=”100%” bordercolor=”#000000″ bgcolor=”#E7FDFE”>
<tr>
<td width=”100%” colspan=”2″ valign=”top”><tiles:insert attribute=”header”/></td>
</tr>
<tr>
<td width=”23%”><tiles:insert attribute=”menu”/></td>
<td width=”77%” valign=”top” valign=”top”><tiles:insert attribute=”body”/></td>
</tr>
<tr>
<td width=”100%” colspan=”2″ valign=”top”><tiles:insert attribute=”bottom”/></td>
</tr>
</table>
</body></html>
—————————————————————-
Loyal WaterMemberCan you paste your installation details here for me. The posting guidelines thread can be found at the top of the forum.
Loyal WaterMemberYour issue is most likely due to the fact that you added Struts 1.2 capabilities, then when you went to create the struts page, you used the Struts 1.1 templates that have their URIs in the form: http://jakarta.apache.org/struts/… instead of http://struts.apache.org/…
-
AuthorPosts