I'm using Struts 1.3.8, Struts Tiles 1.3.8, Velocity 1.4, Velocity Tools 1.3.

I have a problem with #set directive that I hope someone can help me with.

I have a main.vm template (example below) that contains other templates
defined in tiles.xml file.  I need to be able to reuse the same
$tiles.buttonbar template with different values for $buttons reference.

I'm trying to reset $buttons list before the $tiles.buttonbar template is
called.  But it looks like the $tiles.buttonbar template does not see the
values that are set in main.vm.

How can I make the $tiles.buttonbar template to use different $buttons list
every time is loaded?  By the way, I do not want to use a macro.  I am
removing all the macros due to memory issue described in bug
https://issues.apache.org/jira/browse/VELOCITY-223

Here is my main.vm example:

<html>
<head>
        $tiles.importAttributes("request")
</head>
<body>
  $tiles.header
  #set($buttons = $buttons1)
        
  $tiles.buttonbar ## first time buttonbar.vm is used

  $tiles.contents

#if($show2)
  #set ($buttons = $buttons2)
  
  $tiles.buttonbar ## second time buttonbar.vm is used

  $tiles.subcontent
#end
</body>
</html>  

Here is the buttonbar.vm example:

<table><tr>
        #foreach($button in $buttons)
          <td onClick='$msg.get($button.action)'>
                 $msg.get($button.image) $msg.get($button.label)
            </td>
        #end
</tr></table>




-- 
View this message in context: 
http://www.nabble.com/set-directive-and-multiple-velocity-templates-tp15562520p15562520.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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

Reply via email to