Re: Action mapping to a Tile

2005-10-05 Thread Sunil_Sahu
Greg,

1- create one layout.jsp:

%@ taglib uri=http://jakarta.apache.org/struts/tags-tiles; 
prefix=tiles %
HTML
HEAD
title
/title
/head

body bgcolor=#FF text=#00 leftmargin=0 topmargin=0
table width=794 border=0 cellspacing=0 cellpadding=0
  tr
td colspan=2tiles:insert attribute=header//td
  /tr
  tr 
td width=30%  valign=toptiles:insert attribute=left//td
td tiles:insert attribute=body//td
  /tr
/table
/body
/html

2 - add following entry in struts-config.xml
action
  path=/test
  type=org.apache.struts.actions.ForwardAction
  parameter=global.test
/
If you want you can use your own action, in that case you have to provide 
method and forward name also. if you want more detail about this let me 
know.

3 - add following entry in tiles-def.xml
!DOCTYPE tiles-definitions PUBLIC
   -//Apache Software Foundation//DTD Tiles Configuration 1.1//EN
   http://struts.apache.org/dtds/tiles-config_1_1.dtd;
!-- Definitions for Tiles documentation   --
tiles-definitions
  !-- Main page layout used as a root for other pages defintion.   --
   definition name=site.mainLayout path=/common/layout.jsp
  put name=title value=Home Title /
  put name=headervalue=/header.jsp /
  put name=left  value=/leftMenu.jsp /
   /definition
  definition name=global.test extends=site.mainLayout 
  put name=body  value=/test.jsp /
  /definition
/tiles-definitions

4- add following link in your jsp:
  html:link  action=/testTest Link/html:link

try it and let me know if you have  any issue.

Sunil




Greg Reddin [EMAIL PROTECTED] 
01/10/2005 03:23
Please respond to
Struts Users Mailing List user@struts.apache.org


To
Struts Users Mailing List user@struts.apache.org
cc

Subject
Re: Action mapping to a Tile






Are you using the TilesRequestProcessor?  In struts-config.xml:

 controller
processorClass=org.apache.struts.tiles.TilesRequestProcessor/

Also make sure the Tiles Plugin is configured:

 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

Greg

On Sep 30, 2005, at 4:47 PM, Graham Reeds wrote:

 I'm trying to set an action mapping to a tile.

 I have a jsp page with a link to Tester: a href=pages/ 
 TesterTest/a

 In my struts-config.xml I have a forward mapped: action 
 path=pages/Tester forward=Test.page /

 And in tile-def.xml I have Test.page defined:
 definition name=Test.page extends=Main.layout
   put name=title value=Test /
 /definition

 However this gives a 404 for the page test/pages/Tester

 I thought it might be that the application hasn't been updated so I 
 stopped and restarted Tomcat and that had no effect - still 404's.

 Anything else I need to check?

 Thanks Graham Reeds.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Action mapping to a Tile

2005-09-30 Thread Graham Reeds

I'm trying to set an action mapping to a tile.

I have a jsp page with a link to Tester: a href=pages/TesterTest/a

In my struts-config.xml I have a forward mapped: action 
path=pages/Tester forward=Test.page /


And in tile-def.xml I have Test.page defined:
definition name=Test.page extends=Main.layout
  put name=title value=Test /
/definition

However this gives a 404 for the page test/pages/Tester

I thought it might be that the application hasn't been updated so I 
stopped and restarted Tomcat and that had no effect - still 404's.


Anything else I need to check?

Thanks Graham Reeds.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Greg Reddin

Are you using the TilesRequestProcessor?  In struts-config.xml:

controller
   processorClass=org.apache.struts.tiles.TilesRequestProcessor/

Also make sure the Tiles Plugin is configured:

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

Greg

On Sep 30, 2005, at 4:47 PM, Graham Reeds wrote:


I'm trying to set an action mapping to a tile.

I have a jsp page with a link to Tester: a href=pages/ 
TesterTest/a


In my struts-config.xml I have a forward mapped: action  
path=pages/Tester forward=Test.page /


And in tile-def.xml I have Test.page defined:
definition name=Test.page extends=Main.layout
  put name=title value=Test /
/definition

However this gives a 404 for the page test/pages/Tester

I thought it might be that the application hasn't been updated so I  
stopped and restarted Tomcat and that had no effect - still 404's.


Anything else I need to check?

Thanks Graham Reeds.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Mario_Hernandez
just out of curiosity, did you mean to write

a href=pages/Tester.doTest/a

Re: Action mapping to a Tile

2005-09-30 Thread Graham Reeds

Greg Reddin wrote:

Are you using the TilesRequestProcessor?  In struts-config.xml:

controller
   processorClass=org.apache.struts.tiles.TilesRequestProcessor/

Also make sure the Tiles Plugin is configured:

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


Yes. They are the exact carbon copies of mine.  I used the default 
struts-blank.war as my starting point for my testing.


Thanks, Graham.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Dave Newton

Graham Reeds wrote:

In my struts-config.xml I have a forward mapped: action 
path=pages/Tester forward=Test.page /


What happens if you put a leading / in the path?

Dave



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Graham Reeds

[EMAIL PROTECTED] wrote:

just out of curiosity, did you mean to write

a href=pages/Tester.doTest/a


No, the lack of .do is deliberate.  Using do denotes an actual form
action whereas I just want the activation of a generated page by tiles. 
 I suppose I could call it pages/Tester.tile.


This way I can keep all my tiles in the struts-config.xml instead of 
lots of 1 or 2 line jsp files.


G.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Graham Reeds

Dave Newton wrote:

Graham Reeds wrote:

In my struts-config.xml I have a forward mapped: action 
path=pages/Tester forward=Test.page /



What happens if you put a leading / in the path?

Dave


Still get the 404 error message.

I'm not having a lot of luck with Struts. And the lack of useful 
information really hampers any real progress:-(


It seems like I keep hitting brickwalls.

G.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Dave Newton

Graham Reeds wrote:


I have a jsp page with a link to Tester: a href=pages/TesterTest/a


Oh, wait.

See, I don't think that will work. If you use an html:link 
action=pages/TesterTest/html:link that should do it.


a href=... doesn't know about struts.

Are you mapping with *.do? If so, then how would you expect an a 
href=pages/Tester... to be able to find the page?


In my struts-config.xml I have a forward mapped: action 
path=pages/Tester forward=Test.page /


Put the leading / in there anyway and put it in your link tag. Otherwise 
I get nervous.



However this gives a 404 for the page test/pages/Tester


Your webapp is under 'test'? (Just for completeness of info.)

I've never had any real issues with tiles so I suspect you're just not 
paying attention to the docs :)


Dave



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Graham Reeds

Your webapp is under 'test'? (Just for completeness of info.)


Yes it is.

Now with the above changes and I also read that tiles have a convention 
of prefixing period (.) so that has been changed I still get a 404 but 
with the new error message of Invalid path /Tester was requested


struts-config.xml:
action path=/Tester.do forward=.Tester /

tiles-defs.xml:
definition name=.Tester extends=Main.layout
 put name=title value=Test /
/definition

Home.jsp:
html:link action=/Tester.doTester/html:link

Is there anything else I should be doing?

I've never had any real issues with tiles so I suspect you're just not 
paying attention to the docs :)


rant
What docs there are: The Tiles tutorial on Cedric Dumoulin is 4 years 
old and is written for someone who already understands Struts  Tiles, 
which is something I have seen with a lot of struts tutorials - they are 
written from the perspective of someone who already understands the Struts.


The books are even worse, but that is the nature of authorship - by the 
time you have written, proof-read, typeset, reviewed and printed the 
book 1 to 2 years have passed and by that time what you are writing 
about has passed. Hence most books are for Struts 1.02 and 1.1 - not 
1.2x. I suppose that there will be books for 1.3 but I hope that they 
improve on the examples (table is for displaying tabulated data - no 
page layout).

/rant


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Van
On 9/30/05, Graham Reeds [EMAIL PROTECTED] wrote:
 Now with the above changes and I also read that tiles have a convention
 of prefixing period (.) so that has been changed I still get a 404 but
 with the new error message of Invalid path /Tester was requested

 struts-config.xml:
 action path=/Tester.do forward=.Tester /

You don't want the extension in the action mapping, just in the URL. Try this:

action path=/Tester forward=.Tester /

I can't promise that it will work with this change, but, I do believe
this will address the complaint about Invalid path /Tester.

-Van
--
- Mike Van Riper
  [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Graham Reeds

Van wrote:

On 9/30/05, Graham Reeds [EMAIL PROTECTED] wrote:


Now with the above changes and I also read that tiles have a convention
of prefixing period (.) so that has been changed I still get a 404 but
with the new error message of Invalid path /Tester was requested

struts-config.xml:
action path=/Tester.do forward=.Tester /



You don't want the extension in the action mapping, just in the URL. Try this:

action path=/Tester forward=.Tester /

I can't promise that it will work with this change, but, I do believe
this will address the complaint about Invalid path /Tester.


Thankyou! Finally this is working. Now I can move onto actually doing 
something useful. Fortunately no one was footing the bill for this 
learning experience.


G.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Graham Reeds
On a related theme... Is it possible to set it up so the application 
automatically starts with a page from the tile-def.xml bypassing jsp's 
entirely...


I suppose you could do a forward from within index.jsp but why waste 
processor power:-)


G.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Action mapping to a Tile

2005-09-30 Thread Greg Reddin


On Sep 30, 2005, at 8:55 PM, Graham Reeds wrote:


I suppose you could do a forward from within index.jsp


That's the best way I can think of.

Greg

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]