Two Laptop Bag*
The moose likes Struts and the fly likes [TILES] How to include an action as body in a definition [SOLVED] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "[TILES] How to include an action as body in a definition [SOLVED]" Watch "[TILES] How to include an action as body in a definition [SOLVED]" New topic
Author

[TILES] How to include an action as body in a definition [SOLVED]

Roberto Lopez Lopez
Greenhorn

Joined: Jun 16, 2008
Posts: 22
Hi there, here comes a tiles beginner question:

I have written a base definition, from which extends another definition. Here is the content of the tiles-def.xml:

I have succeeded into configuring everything so I can instantiate the page.estimaciones definition from my struts-config.xml without any exception.

Anyway, instead of the content of estimacionesContent.jsp, I get the following output:
:THIS IS THE HEADER
THIS IS THE MENUBAR
The requested resource (/NoLlego/web/jsp/struts/estimaciones/estimaciones) is not available
THIS IS THE COPYRIGHT

Where's my error??? I can't get estimacionesContent.do from tiles... Maybe is an stupid question, but I started to learn tiles yesterday... Please any tip will be appreciated!!!
[ July 03, 2008: Message edited by: Roberto L�pez L�pez ]
Sachin Adat
Ranch Hand

Joined: Sep 03, 2007
Posts: 213
Hi,

I am not an expert in tiles, but If I am getting it right, you should give your path to jsp in the tiles definition and your path of tiles definition in your forward tag in your action mapping.

So replace

with

and

with

In this way, you will forward in your action mapping to a tiles definition, which creates the view using the base definitions and forwards it to your jsp.

Please someone correct me If I am wrong.....

[ July 02, 2008: Message edited by: Sachin Adat ]
[ July 02, 2008: Message edited by: Sachin Adat ]

SCJP 6
How To Ask Questions On Java Ranch - How To Answer Questions On Java Ranch
Roberto Lopez Lopez
Greenhorn

Joined: Jun 16, 2008
Posts: 22
Thanks for your response, Sachin.

I understand your explanation, but just displaying my JSP isn't my real objective. I first tested with that config, but now I need to get the estimaciones.jsp after processing EstimacionesAction.

This is exactly the timeline of what I want:

  • Browser request.
  • struts-config.xml maps to page.estimaciones on tiles-defs.xml.
  • page.estimaciones is composed of: header.jsp, menubar.jsp, copyright.jsp AND /estimacionesContent.do (which generates another jsp).


  • I know it's a little strange but I need to do some operations before getting the estimaciones.jsp.

    Any idea???
    [ July 02, 2008: Message edited by: Roberto L�pez L�pez ]
    Sachin Adat
    Ranch Hand

    Joined: Sep 03, 2007
    Posts: 213
    Hi,

    I am not sure about your requirements, but I think maybe you need to use the tiles controller.

    There is a good tutorial here
    Tiles Controller Class by Patrick Peak

    Check for Controller class.
    Roberto Lopez Lopez
    Greenhorn

    Joined: Jun 16, 2008
    Posts: 22
    Thanks Sachin, nice page... I'll keep it at my bookmarks :-D

    Anyway, I've just solved the mistery... I had an error at estimaciones.jsp (a tag mistake) and tiles just displayed that short message "The requested resource is not available"... I don't know why it didn't displayed the error on the console, but finally I found it.

    Thank you!!!
    [ July 03, 2008: Message edited by: Roberto L�pez L�pez ]
    Sachin Adat
    Ranch Hand

    Joined: Sep 03, 2007
    Posts: 213
    Great job ........
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: [TILES] How to include an action as body in a definition [SOLVED]
     
    Similar Threads
    Problem with Tiles-Definition
    Configuring Tiles in Struts Error
    struts 2: tiles problem
    Struts2 CannotRenderException
    adding action mapping to struts-config