Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials

Core Java
JSP
Servlet
JDBC
Hibernate
Struts 1
Struts 2
JSF
Spring
J2EE
J2ME
Web Services
Ajax
Dojo
MySQL
Latest Comments
library management
comment
Servlets with the
trigger
Make me a Trigger
  All Comments...
 

 

 
Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*tiles-defs.xml
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
*AGGREGATING ACTIONS
*Internationalization
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Alternative
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Struts Reference
*Struts Resources
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Struts Using Tiles Defs Xml

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

24 comments so far (post your own) View All Comments Latest 10 Comments:

I would like to Display dynamic content on alert box. Is it possible?

Posted by Amit Kumar Mishra on Thursday, 04.3.08 @ 18:28pm | #55235


Please give How to set CLASSPATH IN STRUTS TILE

THANK YOU

Posted by mahender on Saturday, 12.29.07 @ 17:50pm | #44137

if you set up your web.xml correctly with the taglibs you can do the following to use tiles defintions.

<%@ taglib uri="taglibs/struts-tiles" prefix="tiles"%>
<tiles:insert definition="your.layout" >
<tiles:put name="content" value="foo.jsp"/>
</tiles:insert>

Posted by muz on Tuesday, 10.16.07 @ 18:02pm | #34213

How to implements the stutsframe work in 'Eclipse'

Posted by K.Naga Krishna on Friday, 06.29.07 @ 08:02am | #20359

This is the best tutorial people really who wants to learn struts.step by step explination with examples makes to understand more easily.

Posted by sharon on Tuesday, 06.19.07 @ 17:11pm | #19706

its good book for beginers.

Posted by vidyadhar on Friday, 06.8.07 @ 21:12pm | #18625

How to use definations without creating defination for every single content pages.

Posted by bay1234 on Thursday, 05.31.07 @ 18:32pm | #17865

Hi,
I would like to use tiles for dynamic action, it means that I have 2 tiles template, each of them will set different action name to the JSP.
for example:
For mobile product I set the action
<definition name="mobile" template="/search.jsp">
<put name="actionName" value="/mobileSearch.do"/>
</definition>
For land line:
<definition name="land" template="/search.jsp">
<put name="actionName" value="/landSearch.do"/>
</definition>

in the jsp I set the action name like that:
<html:form action="<tiles:getAsString name="actionName"/>">
.
.
</html:form>
I got an exception.
How can I do that using tiles?
Is it possible?
Thanks,
Jaron

Posted by Jaron on Thursday, 05.10.07 @ 13:20pm | #15560

In Struts Tiles definition,we have to create our own tiles-def.xml file or it will be there in the project itself..Please do help on this

Posted by Leena on Friday, 03.30.07 @ 10:41am | #12968

Hey Monib,

Create the following chain-config.xml in your WEB-INF directory in addition to what Rajesh said:

<?xml version="1.0" ?>


<!--

Copyright 2002,2004 The Apache Software Foundation.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->


<!--
This file contains definitions of the standard Chain Of Responsibility
chains that emulate Struts 1.2 processing functionality. These chains
are defined in a catalog named "struts" so that the application can
use the default catalog for its own purposes, without any potential for
name clashes.

$Id$
-->


<catalog name="struts">

<define name="lookup"
className="org.apache.commons.chain.generic.LookupCommand"/>
<!-- ========== Servlet Complete Request Chain ========================= -->

<chain name="servlet-standard">

<!-- Establish exception handling filter -->
<command
className="org.apache.struts.chain.commands.ExceptionCatcher"
catalogName="struts"
exceptionCommand="servlet-exception"/>

<lookup
catalogName="struts"
name="process-action"
optional="false"/>

<lookup
catalogName="struts"
name="process-view"
optional="false"/>

</chain>


<!-- ========== Action Processing chain ======================== -->
<chain name="process-action">

<!--
This chain attempts to emulate (most of) the standard request
processing in the standard org.apache.struts.action.RequestProcessor
class, by performing the corresponding tasks in individual Commands
that are composable. The following list defines a cross reference
between the processXxx methods and the Commands that perform the
corresponding functionality:

processMultipart Integrated into servlet and legacy classes

processPath SelectAction (which also does processMapping)

processException ExceptionCatcher / ExceptionHandler

processLocale SelectLocale

processContent SetContentType

processNoCache RequestNoCache

processPreprocess LookupCommand with optional="true". Multiple
occurrences of this can easily be added, to
support additional processing hooks at any
point in the chain without modifying the
standard definition.

processCachedMessages RemoveCachedMessages

processMapping SelectAction (which also does processPath)

processRoles AuthorizeAction

processActionForm CreateActionForm

processPopulate PopulateActionForm

processValidate ValidateActionForm / SelectInput

processForward SelectForward

processInclude SelectInclude / PerformInclude

processActionCreate CreateAction

processActionPerform ExecuteAction
-->


<!-- Look up optional preprocess command -->
<lookup
catalogName="struts"
name="servlet-standard-preprocess"
optional="true"/>


<!-- Identify the Locale for this request -->
<command
className="org.apache.struts.chain.commands.servlet.SelectLocale"/>


<!-- Set (if needed) the URI of the original request -->
<command
className="org.apache.struts.chain.commands.servlet.SetOriginalURI"/>


<!-- Set (if needed) no cache HTTP response headers -->
<command
className="org.apache.struts.chain.commands.servlet.RequestNoCache"/>


<!-- Set (if needed) the HTTP response content type -->
<command
className="org.apache.struts.chain.commands.servlet.SetContentType"/>


<!-- Remove messages cached in the Session -->
<command
className="org.apache.struts.chain.commands.RemoveCachedMessages"/>


<!-- Identify the ActionConfig for this request -->
<command
className="org.apache.struts.chain.commands.servlet.SelectAction"/>


<!-- Authorize the selected ActionConfig for this request -->
<command
className="org.apache.struts.chain.commands.servlet.AuthorizeAction"/>


<!-- Create (if needed) the ActionForm for this request -->
<command
className="org.apache.struts.chain.commands.CreateActionForm"/>


<!-- Populate the ActionForm for this request -->
<command
className="org.apache.struts.chain.commands.servlet.PopulateActionForm"/>


<!-- Validate the ActionForm for this request -->
<command
className="org.apache.struts.chain.commands.servlet.ValidateActionForm"/>


<!-- Select the appropriate ForwardConfig for return to input page -->
<command
className="org.apache.struts.chain.commands.servlet.SelectInput"/>


<!-- Lookup and execute a chain command if the current ActionConfig is
so-configured. -->
<command
className="org.apache.struts.chain.commands.ExecuteCommand"/>


<!-- Select the appropriate ForwardConfig for action mappings that only
have an ActionForward -->
<command
className="org.apache.struts.chain.commands.servlet.SelectForward"/>


<!-- Select the include uri (if any) for the current action mapping -->
<command
className="org.apache.struts.chain.commands.SelectInclude"/>


<!-- Perform the include (if needed) -->
<command
className="org.apache.struts.chain.commands.servlet.PerformInclude"/>


<!-- Create (if needed) the Action for this request -->
<command
className="org.apache.struts.chain.commands.servlet.CreateAction"/>


<!-- Execute the Action for this request -->
<command
className="org.apache.struts.chain.commands.servlet.ExecuteAction"/>
</chain>

<!-- ========== View Processing chain ======================== -->
<chain name="process-view">


<!-- Lookup and execute a chain command if the current ForwardConfig is
so-configured. -->
<command
className="org.apache.struts.chain.commands.ExecuteForwardCommand"/>

<command
className="org.apache.struts.tiles.commands.TilesPreProcessor"/>

<!-- Follow the returned ForwardConfig (if any) -->
<command
className="org.apache.struts.chain.commands.servlet.PerformForward"/>


</chain>

<!-- ========== Servlet Exception Handler Chain ======================== -->

<chain name="servlet-exception">

<!--
This chain is designed to be invoked (by o.a.s.c.ExceptionCatcher)
if an unhandled exception is thrown by any subsequent command
in a processing chain (including the one that invokes a Struts
action). The standard definition of this chain supports the
exception mapping of Struts 1.1, but can be replaced in order
to handle exceptions differently.
-->

<!-- Execute the configured exception handler (if any) -->
<command
className="org.apache.struts.chain.commands.servlet.ExceptionHandler"/>

<!-- Lookup and execute a chain command if the current ForwardConfig is
so-configured. -->
<command
className="org.apache.struts.chain.commands.ExecuteForwardCommand"/>

<command
className="org.apache.struts.tiles.commands.TilesPreProcessor"/>

<!-- Follow the returned ForwardConfig (if any) -->
<command
className="org.apache.struts.chain.commands.servlet.PerformForward"/>

</chain>


</catalog>

Posted by Joel Luellwitz on Friday, 03.16.07 @ 01:17am | #11852

Hi Rajesh,

I did what you said about chain-config.xml, but I got the same error:

javax.servlet.ServletException: Path TilesExample does not start with a "/" character

Posted by monib on Tuesday, 02.20.07 @ 14:24pm | #8468

I want a complete application in tiles with links to move here and there

Posted by phanindra on Saturday, 02.3.07 @ 17:57pm | #5711

its a really very good material for starters

Posted by Srinivas on Thursday, 01.25.07 @ 18:01pm | #4353

hi Prad ,Digambar

i got the same problem u got
javax.servlet.ServletException: Path Tiles.Example does not start with a "/" character

the solution is

add chain-config.xml to your web-inf folder
and add this entry
<init-param>
<param-name>chainConfig</param-name>
<param-value>/WEB-INF/chain-config.xml</param-value>
</init-param>

as same as struts-config to ActionServlet in web.xml

regards
Rajesh
http://sabrenews.blogspot.com

Posted by Rajesh on Tuesday, 01.23.07 @ 23:13pm | #4198

Really Very nice tutorial to learn struts. Especially for beginners.

Posted by PM on Thursday, 01.18.07 @ 14:26pm | #3752

make sure you have forward slash before 'T' in Tiles/Example.

Posted by MP on Thursday, 01.18.07 @ 14:00pm | #3747

coded this program but I am getting error as
javax.servlet.ServletException: Path Tiles.Example does not start with a "/" character
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

.
Is there any solution ?
This is similar to what digambar got...If u have any sol please share with me..

Posted by prad on Wednesday, 01.17.07 @ 21:41pm | #3696

I coded this program but I am getting error as
javax.servlet.ServletException: Path Tiles.Example does not start with a "/" character
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

.
Is there any solution ?

Posted by digambar on Monday, 01.15.07 @ 05:46am | #3512

This is a long one...sorry for that..

I need to know how to invoke tiles framework from a JSP without moving control to the action class etc.
Say I have contacts.jsp which just lists down the contacts. Suppose on home page, there is a link "contacts". When user clicks this link, he/she should be presented with the contacts.jsp keeping header, footer and all same as home page.

As of now say I have tiles implemented with my header,footer and content page separated. I access the home page using *.do pattern instead of directly accessing the JSP. This would bring tiles framework into picture. So I have all my header,footer and main page displayed. Now what should be the target for the "contact" link.
If I simply put contact.jsp in in "A href", it would not display header and footer. If I put contact.do, then I have to put an action path in struts-config, create an Action class which will do nothing but to return a forward and invoke tiles.
I need to know what should I do so that contacts page is displayed (With header and footer) without creating action class and an entry in struts-config.

Posted by Rohit on Wednesday, 01.10.07 @ 20:03pm | #3143

Its very easy to understand & very helpfull to me.
Thanks

Posted by Anant Patel on Wednesday, 12.20.06 @ 15:48pm | #1334

This one is a really good tutorial for a beginner and gives a good basic idea about struts n also presented with good examples. A beginner can get an basic idea how to work on struts.

Posted by Kamal on Tuesday, 12.19.06 @ 15:00pm | #1233

thanks

its really useful to beginnar to learn tiles using such simple example

Posted by qwrqw on Tuesday, 12.19.06 @ 09:35am | #1218

hi thanks for sending this

Posted by Janga on Tuesday, 11.28.06 @ 15:08pm | #176

Congratulations,
perfect example,
It's a good beginning for learning Tiles.

See ya one day

Posted by Fabio on Friday, 11.24.06 @ 20:29pm | #99

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.