RE: [Tiles] Populating Tiles definition attribute at runtime

2003-12-30 Thread Robert Taylor
Thanks to all who replied. I'll look into each suggested solution more
closely.

robert

 -Original Message-
 From: Robert Taylor [mailto:[EMAIL PROTECTED]
 Sent: Monday, December 29, 2003 2:15 PM
 To: Struts Users Mailing List
 Subject: RE: [Tiles] Populating Tiles definition attribute at runtime


 Thanks for the reply Pedro, but I was looking for a cleaner solution.

 robert

  -Original Message-
  From: Pedro Salgado [mailto:[EMAIL PROTECTED]
  Sent: Monday, December 29, 2003 12:51 PM
  To: Struts Users Mailing List
  Subject: Re: [Tiles] Populating Tiles definition attribute at runtime
 
 
 
I don¹t know if it is possible to change a tiles definition at
  runtime but
  a solution to your problem could be solved by specifying a
 definition that
  uses a jsp file that does a conditional include according to a given
  parameter?
 
  definition name=choose.def extends=base.def
put name=header value=/header.jsp/
 put name=body value=/choose.jsp/  -
 put name=footer value=/footer.jsp/
  /definition
 
   choose.jsp
 
  c:import url='/WEB-INF/com/website/tiles/choose/${request.choose}'/
 
 
  Pedro Salgado
 
 
  On 29/12/2003 17:46, Robert Taylor [EMAIL PROTECTED] wrote:
 
   Greetings, I have a tiles definition in my tiles-defs.xml
  similar to below:
  
   definition name=search extends=layout
 put name=heading value={0}Search type=string /
 put name=content value=/search.jsp type=page /
   /definition
  
   which I would like to be able to modify the heading value such that
   at runtime I could substitute a value for {0}.
  
   For example, it would be ideal to use a JSTL type of syntax such as:
  
   definition name=search extends=layout
 put name=heading value=${param.myValue}Search type=string /
 put name=content value=/search.jsp type=page /
   /definition
  
   but this does not work.
  
  
  
   robert
  
   -
   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]
 


 -
 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: [Tiles] Populating Tiles definition attribute at runtime

2003-12-29 Thread Pedro Salgado

  I don¹t know if it is possible to change a tiles definition at runtime but
a solution to your problem could be solved by specifying a definition that
uses a jsp file that does a conditional include according to a given
parameter?

definition name=choose.def extends=base.def
  put name=header value=/header.jsp/
   put name=body value=/choose.jsp/  -
   put name=footer value=/footer.jsp/
/definition

 choose.jsp

c:import url='/WEB-INF/com/website/tiles/choose/${request.choose}'/


Pedro Salgado


On 29/12/2003 17:46, Robert Taylor [EMAIL PROTECTED] wrote:

 Greetings, I have a tiles definition in my tiles-defs.xml similar to below:
 
 definition name=search extends=layout
   put name=heading value={0}Search type=string /
   put name=content value=/search.jsp type=page /
 /definition
 
 which I would like to be able to modify the heading value such that
 at runtime I could substitute a value for {0}.
 
 For example, it would be ideal to use a JSTL type of syntax such as:
 
 definition name=search extends=layout
   put name=heading value=${param.myValue}Search type=string /
   put name=content value=/search.jsp type=page /
 /definition
 
 but this does not work.
 
 
 
 robert
 
 -
 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: [Tiles] Populating Tiles definition attribute at runtime

2003-12-29 Thread Robert Taylor
Thanks for the reply Pedro, but I was looking for a cleaner solution.

robert

 -Original Message-
 From: Pedro Salgado [mailto:[EMAIL PROTECTED]
 Sent: Monday, December 29, 2003 12:51 PM
 To: Struts Users Mailing List
 Subject: Re: [Tiles] Populating Tiles definition attribute at runtime



   I don¹t know if it is possible to change a tiles definition at
 runtime but
 a solution to your problem could be solved by specifying a definition that
 uses a jsp file that does a conditional include according to a given
 parameter?

 definition name=choose.def extends=base.def
   put name=header value=/header.jsp/
put name=body value=/choose.jsp/  -
put name=footer value=/footer.jsp/
 /definition

  choose.jsp

 c:import url='/WEB-INF/com/website/tiles/choose/${request.choose}'/


 Pedro Salgado


 On 29/12/2003 17:46, Robert Taylor [EMAIL PROTECTED] wrote:

  Greetings, I have a tiles definition in my tiles-defs.xml
 similar to below:
 
  definition name=search extends=layout
put name=heading value={0}Search type=string /
put name=content value=/search.jsp type=page /
  /definition
 
  which I would like to be able to modify the heading value such that
  at runtime I could substitute a value for {0}.
 
  For example, it would be ideal to use a JSTL type of syntax such as:
 
  definition name=search extends=layout
put name=heading value=${param.myValue}Search type=string /
put name=content value=/search.jsp type=page /
  /definition
 
  but this does not work.
 
 
 
  robert
 
  -
  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]



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



Re: [Tiles] Populating Tiles definition attribute at runtime

2003-12-29 Thread Brice Ruth
The cleanest thing to do here, likely, would be to have your 'content' 
attribute have a value that maps to an Action (/search.do would work, I 
think - Vic might be able to confirm this) and in the Action class, 
define an attribute heading stored in request context, that pulls from 
request parameters. The tiles-defs.xml isn't really a dynamic 
mechanism in any way - its a config file that is loaded - it isn't 
treated as a JSP that gets compiled into a .java and then compiled to a 
.class servlet.

Alternately, just set your heading attribute in tiles-defs.xml to be 
Search or whatever you want, and in the /search.jsp file, use JSTL to 
prepend param.myValue. This would be pretty clean for simple scenarios.

Robert Taylor wrote:

Greetings, I have a tiles definition in my tiles-defs.xml similar to below:

definition name=search extends=layout
   put name=heading value={0}Search type=string /
   put name=content value=/search.jsp type=page /
 /definition
which I would like to be able to modify the heading value such that
at runtime I could substitute a value for {0}. 

For example, it would be ideal to use a JSTL type of syntax such as:

definition name=search extends=layout
   put name=heading value=${param.myValue}Search type=string /
   put name=content value=/search.jsp type=page /
 /definition
but this does not work.



robert

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

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [Tiles] Populating Tiles definition attribute at runtime

2003-12-29 Thread Domingo A. Rodriguez S.

Hi Robert..

I guess you could achieve the same using the controllerClass attribute and
building your class.. For instance, I have this definition in the
tiles-defs.xml file:
---
   definition name=.layout 
   path=/common/layout.jsp
controllerClass='com.dars.XTileAction'
 put name=title   value=Encabezado primario/
 put name=leftsidevalue=/common/leftside.jsp/
 put name=rightside   value=/common/rightside.jsp/
 put name=header  value=/common/header.jsp/
 put name=footer  value=/common/footer.jsp/
 put name=bodyvalue=/common/body.jsp/
   /definition
---
  And I have this controllerClass
---
package com.dars;
import org.apache.struts.tiles.actions.TilesAction;
import org.apache.struts.tiles.ComponentContext;
import org.apache.struts.tiles.Controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import java.io.IOException;

public class XTileAction extends TilesAction implements Controller{
public void perform(ComponentContext tilesctx,
HttpServletRequest request,
HttpServletResponse response,
ServletContext servctx) 
throws ServletException, IOException{
 /* GetAttributes */
 String titulo= (String)tilesctx.getAttribute(title);
 String derecha= (String)tilesctx.getAttribute(rightside);
 /* GetAttributes */ 
 System.out.println(  Titulo: +titulo);
 System.out.println( Derecha: +derecha);
 /* SetAttributes */
   tilesctx.putAttribute(title, Titulo nuevo de esta vaina..);
   tilesctx.putAttribute(rightside, /common/footer.jsp);
 /* SetAttributes */
}
}
---
You can change the values of those attributes at runtime. I prefer to do
it using this method.

Atte.
Domingo A. Rodriguez S.


 --- Robert Taylor [EMAIL PROTECTED] escribió:  Greetings, I have a
tiles definition in my tiles-defs.xml similar to
 below:
 
  definition name=search extends=layout
 put name=heading value={0}Search type=string /
 put name=content value=/search.jsp type=page /
   /definition
 
 which I would like to be able to modify the heading value such that
 at runtime I could substitute a value for {0}. 
 
 For example, it would be ideal to use a JSTL type of syntax such as:
 
 definition name=search extends=layout
 put name=heading value=${param.myValue}Search type=string /
 put name=content value=/search.jsp type=page /
   /definition
 
 but this does not work.
 
 
 
 robert
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
  

_
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

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



Re: [Tiles] Populating Tiles definition attribute at runtime

2003-12-29 Thread Brice Ruth
Wow, that's pretty cool ... I'll have to check out the controllerClass 
stuff sometime :)

Domingo A. Rodriguez S. wrote:

Hi Robert..

I guess you could achieve the same using the controllerClass attribute and
building your class.. For instance, I have this definition in the
tiles-defs.xml file:
---
  definition name=.layout 
  path=/common/layout.jsp
   controllerClass='com.dars.XTileAction'
put name=title   value=Encabezado primario/
put name=leftsidevalue=/common/leftside.jsp/
put name=rightside   value=/common/rightside.jsp/
put name=header  value=/common/header.jsp/
put name=footer  value=/common/footer.jsp/
put name=bodyvalue=/common/body.jsp/
  /definition
---
 And I have this controllerClass
---
package com.dars;
import org.apache.struts.tiles.actions.TilesAction;
import org.apache.struts.tiles.ComponentContext;
import org.apache.struts.tiles.Controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import java.io.IOException;

public class XTileAction extends TilesAction implements Controller{
   public void perform(ComponentContext tilesctx,
   HttpServletRequest request,
   HttpServletResponse response,
   ServletContext servctx) 
   throws ServletException, IOException{
/* GetAttributes */
String titulo= (String)tilesctx.getAttribute(title);
String derecha= (String)tilesctx.getAttribute(rightside);
/* GetAttributes */ 
System.out.println(  Titulo: +titulo);
System.out.println( Derecha: +derecha);
/* SetAttributes */
  tilesctx.putAttribute(title, Titulo nuevo de esta vaina..);
  tilesctx.putAttribute(rightside, /common/footer.jsp);
/* SetAttributes */
   }
}
---
You can change the values of those attributes at runtime. I prefer to do
it using this method.

Atte.
Domingo A. Rodriguez S.
--- Robert Taylor [EMAIL PROTECTED] escribió:  Greetings, I have a
tiles definition in my tiles-defs.xml similar to
 

below:

definition name=search extends=layout
   put name=heading value={0}Search type=string /
   put name=content value=/search.jsp type=page /
 /definition
which I would like to be able to modify the heading value such that
at runtime I could substitute a value for {0}. 

For example, it would be ideal to use a JSTL type of syntax such as:

definition name=search extends=layout
   put name=heading value=${param.myValue}Search type=string /
   put name=content value=/search.jsp type=page /
 /definition
but this does not work.



robert

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

_
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [Tiles] Populating Tiles definition attribute at runtime

2003-12-29 Thread Paul-J Woodward

I modified the ActionServlet (might not be necessary - need to investigate the dynamic 
module config stuff further), created a new TilesDefinitionFactory and changed a few 
other bits and made tiles extract all of its definitions from a database. I also 
implemented a cache mechanism as a Java servlet so that database access was minimal.

This was all because I need a site that was truly dynamic, whilst running on a cluster 
of servers.

Paul

Global Equity Derivatives Technology
Deutsche Bank [/]
Office  +44 (0)20 754 55458
Mobile +44 (0)7736 299483
Fax  +44 (0)20 7547 2752



   
   
 
  Brice Ruth   
   
 
  [EMAIL PROTECTED]To:   Struts Users Mailing List 
[EMAIL PROTECTED]

  m   cc: 
   
 
   Subject:  Re: [Tiles] Populating Tiles 
definition attribute at runtime
  
  29/12/2003 19:20 
   
 
  Please respond to
   
 
  Struts Users
   
 
  Mailing List
   
 
   
   
 
   
   
 




Wow, that's pretty cool ... I'll have to check out the controllerClass
stuff sometime :)

Domingo A. Rodriguez S. wrote:

Hi Robert..

I guess you could achieve the same using the controllerClass attribute and
building your class.. For instance, I have this definition in the
tiles-defs.xml file:
---
   definition name=.layout
   path=/common/layout.jsp
controllerClass='com.dars.XTileAction'
 put name=title   value=Encabezado primario/
 put name=leftsidevalue=/common/leftside.jsp/
 put name=rightside   value=/common/rightside.jsp/
 put name=header  value=/common/header.jsp/
 put name=footer  value=/common/footer.jsp/
 put name=bodyvalue=/common/body.jsp/
   /definition
---
  And I have this controllerClass
---
package com.dars;
import org.apache.struts.tiles.actions.TilesAction;
import org.apache.struts.tiles.ComponentContext;
import org.apache.struts.tiles.Controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import java.io.IOException;

public class XTileAction extends TilesAction implements Controller{public void 
perform(ComponentContext tilesctx,
HttpServletRequest request,
HttpServletResponse response,
ServletContext servctx)
throws ServletException, IOException{ /* GetAttributes */
 String titulo= (String)tilesctx.getAttribute(title);
 String derecha= (String)tilesctx.getAttribute(rightside);
 /* GetAttributes */
 System.out.println(  Titulo: +titulo);
 System.out.println( Derecha: +derecha);
 /* SetAttributes */
   tilesctx.putAttribute(title, Titulo nuevo de esta vaina..);
   tilesctx.putAttribute(rightside, /common/footer.jsp);
 /* SetAttributes */
}
}
---
You can change the values of those