hello friends,, I m new to
struts n using tiles. I have made a simple application. i have created all the files required but pages are coming up without the tiles. means application is working but without tiles. what could be the problem. i m giving the source code for various files.
beside the code i m providing, I have made two files namely Pass.jsp and Fail.jsp which are the forward files from the submit.jsp file(simple
Jsp files) and I have Action class which is forwarding to another page based upon simple if-else condition. kindly tell whats wrong with the code.
-----main jsp ... submit.jsp---------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
<head>
<title>Form Submission</title>
</head>
<body>
<h3>form submit page</h3>
<html:errors/>
<html:form action="submit.do">
Last Name: <html:text property="lastName"/><br>
First Name: <html:text property="firstName"/><br>
<html:submit/><br>
<html:link action="home">Home</html:link>
</html:form>
</body>
</html>
-----------------------------------
----------siteLayout.jsp--------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html:html>
<head>
<html:base/>
<title><tiles:getAsString name="title"/></title>
</head>
<body>
<table border="0" width="100%" cellspacing="5">
<tr>
<td><tiles:insert attribute="header"></td>
</tr>
<tr>
<td><tiles:insert attribute="body"></td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td><tiles:insert attribute="footer"></td>
</tr>
</table>
</body>
</html:html>
------------------------------------------------------------
----------header n footer.jap------------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
<head>
<title></title>
<link type="text/css" rel="stylesheet" href="style.css">
</head>
<body>
<h2><b>Sandy Express Shuttle Service</b></h2>
</body>
</html>
--------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
<head>
<title></title>
<link type="text/css" rel="stylesheet" href="style.css">
</head>
<body>
<h2>For more information please call the office Toll-Free 888-467-0000 OR 408-855-8888</h2> </br>
---------------------------------------------------------------</br>
<h3>HOME| RESERVATION | FARE QUOTE | CONTACT US </h3></br>
<h3>All rights reserved - � 2004 Sandy Express Airport Shuttle Services </h3>
</body>
</html>
0----------------------------
Struts-config.xml--------------------------
<?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 Bean Definitions -->
<form-beans>
<form-bean
name="dynaSubmitForm"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="lastName"
type="java.lang.String"/>
<form-property
name="firstName"
type="java.lang.String"/>
</form-bean>
</form-beans>
<!-- ========================================= Global Exception Definitions -->
<global-exceptions>
<!-- sample exception handler
<exception
key="expired.password"
type="app.ExpiredPasswordException"
path="/changePassword.jsp"/>
end sample -->
</global-exceptions>
<!-- =========================================== Global Forward Definitions -->
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward
name="welcome"
path="/welcome.do"/>
<forward
name="home"
path="/home.do"/>
</global-forwards>
<!-- =========================================== Action Mapping Definitions -->
<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/home"
forward="/pages/Welcome.jsp"/>
<action
path="/welcome"
forward="/pages/Welcome.jsp"/>
<action
path="/submit"
type="com.dyna.DynaSubmitAction"
name="dynaSubmitForm"
scope="request"
validate="true"
input="/submit">
<forward name="success" path="/Pass.jsp"/>
<forward name="failure" path="/fail"/>
</action>
</action-mappings>
<!-- ============================================= Controller Configuration -->
<controller
processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<!-- ======================================== Message Resources Definitions -->
<message-resources parameter="MessageResources" />
<!-- =============================================== Plug Ins Configuration -->
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<!-- Path to XML definition file -->
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<!-- Set Module-awareness to true -->
<set-property property="moduleAware" value="true" />
</plug-in>
<!-- =================================================== Validator plugin -->
<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>
-----------------------------------------------------------------------