• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

new to tiles please help

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>

-----------------------------------------------------------------------
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check if you have added the taglib entries in the web.xml file.
 
sandeep kumar jangra
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanx leonardo,, i havent touched web.xml but i guess entries are already there. i just extracted the struts-blank.jar. i m giving the web.xml content. please see if anything more is to be added.

------------web.xml-----------------


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

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<display-name>Struts Blank Application</display-name>

<!-- Standard Action Servlet Configuration (with debugging) -->
<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>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>


<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>


<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

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

<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>

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

</web-app>
-----------------------------------------------------------
regards
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic