You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Kunal H. Parikh" <ku...@carsales.com.au> on 2004/04/29 01:56:29 UTC

RE: REPOST: Determining tiles definition name from JSP

Hi All!

I was wondering if it is allright to add the tiles definiton name being 
processed in Globals and set it as a request attribute.

Then, in the TilesRequestProcessor.processForwardConfig(...) method, we set
the value of the tiles request being processed.

Following is some code to do it.

POA
===
Globals
=======
Key Name: TILES_DEF_NAME_KEY
Key Value: org.apache.struts.tiles.TILES_DEFINITION_NAME

TilesRequestProcessor
=====================
MethodName: processForwardConfig
MODS:
Do following:
===========================
if( processTilesDefinition )
{
...
request.setAttribute( Globals.TILES_DEF_NAME_KEY, forward.getPath() );
...
}
...
===========================


If some committer agrees with this solution, I can try submitting a patch.


TIA,

Kunal

-----Original Message-----
From: Liu, Anne I [mailto:anne.liu@twc.state.tx.us] 
Sent: Wednesday, 28 April 2004 00:46
To: 'Struts Users Mailing List'
Subject: RE: REPOST: Determining tiles definition name from JSP

The only way I found to do it was to have a action mapped for each tiles
definition.  For example....

		<action path="/exampleHome" forward="pages.examples.home" />

Then when I go to the URL http://localhost:80/CTX/exampleHome.do, for the
code below, I get "pages.examples.home"

String tilesName = null;
ActionMapping mapping =
(ActionMapping)request.getAttribute(Globals.MAPPING_KEY);
if(mapping != null) {//tiles
	tilesName = mapping.getForward();
}

I hope this helps!





> -----Original Message-----
> From:	Kunal H. Parikh [SMTP:kunalp@carsales.com.au]
> Sent:	Monday, April 26, 2004 2:00 AM
> To:	'Struts Users Mailing List'
> Subject:	REPOST: Determining tiles definition name from JSP
> 
> Hi All!
> 
> Is it possible to determine the name of the tiles definition being
> processed
> from within a JSP page?
> 
> I am attempting to have an XML menu with IDs exactly the same as the name
> of
> the tile definition.
> 
> Then I would do some XSLT, and id matching and fetch the appropriate XML
> fragment.
> 
> 
> TIA,
> 
> Kunal
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


RES: [struts] RE: REPOST: Determining tiles definition name from JSP

Posted by Paulo Alvim <al...@powerlogic.com.br>.
Anyone could tell me if this has been done?

I need to get the Tiles Definition Name in the Tiles Controller Class...

Thanks in advance!

-----Mensagem original-----
De: Kunal H. Parikh [mailto:kunalp@carsales.com.au]
Enviada em: quarta-feira, 28 de abril de 2004 20:56
Para: 'Struts Users Mailing List'
Cc: struts-dev@jakarta.apache.org
Assunto: [struts] RE: REPOST: Determining tiles definition name from JSP


Hi All!

I was wondering if it is allright to add the tiles definiton name being 
processed in Globals and set it as a request attribute.

Then, in the TilesRequestProcessor.processForwardConfig(...) method, we set
the value of the tiles request being processed.

Following is some code to do it.

POA
===
Globals
=======
Key Name: TILES_DEF_NAME_KEY
Key Value: org.apache.struts.tiles.TILES_DEFINITION_NAME

TilesRequestProcessor
=====================
MethodName: processForwardConfig
MODS:
Do following:
===========================
if( processTilesDefinition )
{
...
request.setAttribute( Globals.TILES_DEF_NAME_KEY, forward.getPath() );
...
}
...
===========================


If some committer agrees with this solution, I can try submitting a patch.


TIA,

Kunal

-----Original Message-----
From: Liu, Anne I [mailto:anne.liu@twc.state.tx.us] 
Sent: Wednesday, 28 April 2004 00:46
To: 'Struts Users Mailing List'
Subject: RE: REPOST: Determining tiles definition name from JSP

The only way I found to do it was to have a action mapped for each tiles
definition.  For example....

		<action path="/exampleHome" forward="pages.examples.home" />

Then when I go to the URL http://localhost:80/CTX/exampleHome.do, for the
code below, I get "pages.examples.home"

String tilesName = null;
ActionMapping mapping =
(ActionMapping)request.getAttribute(Globals.MAPPING_KEY);
if(mapping != null) {//tiles
	tilesName = mapping.getForward();
}

I hope this helps!





> -----Original Message-----
> From:	Kunal H. Parikh [SMTP:kunalp@carsales.com.au]
> Sent:	Monday, April 26, 2004 2:00 AM
> To:	'Struts Users Mailing List'
> Subject:	REPOST: Determining tiles definition name from JSP
> 
> Hi All!
> 
> Is it possible to determine the name of the tiles definition being
> processed
> from within a JSP page?
> 
> I am attempting to have an XML menu with IDs exactly the same as the name
> of
> the tile definition.
> 
> Then I would do some XSLT, and id matching and fetch the appropriate XML
> fragment.
> 
> 
> TIA,
> 
> Kunal
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org