How to restrict who may read my entries?
Name parameter redefinition in freemarker
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > Java Programming > Name parameter redefinition in freemarker 7 March 2006 16:09:43

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

Name parameter redefinition in freemarker

Xavier Lepaul 7 March 2006 16:09:43
 Hi,
I want to create a new component for number range in my forms. the usage would be :

<ww:component template="range" label="myLabel">
<ww:p­aram name="name1" value="toto"/>
<ww:p­aram name="name2" value="bibi"/>
</ww:component>

which would render something like :

<label>myLabel :</label>
<input type="text" name="toto"/> - <input type="text" name="bibi"/>

I try to reuse the template text.ftl by writing my range.ftl like this :

<#assign parameters.name = parameters.name1 />
<#include "/template/hdpsimpl­e/text.ftl" />
<#assign parameters.name = parameters.name2 />
<#include "/template/hdpsimpl­e/text.ftl" />

but freemarker doesn't support assignation of subvar : http://freemarker.s­ourceforge.net/docs/­ref_directive_assign­.html#autoid_88 do you have an idea on how do do that ?
Thanks in advance.
-------------------­--------------------­--------------------­----------
Posted via Jive Forums
http://forums.opens­ymphony.com/thread.j­spa?threadID=21301&m­essageID=41135#41135­

-------------------­--------------------­--------------------­----------
To unsubscribe, e-mail: users-unsubscribe@w­ebwork.dev.java.net
For additional commands, e-mail: users-help@webwork.­dev.java.net


Add comment
Philip Luppens 7 March 2006 15:19:06 permanent link ]
 How about simple using 2 <@ww.textfield> tags in your component's ftl then ? Would that work ?
-------------------­--------------------­--------------------­----------
Posted via Jive Forums
http://forums.opens­ymphony.com/thread.j­spa?threadID=21301&m­essageID=41136#41136­

-------------------­--------------------­--------------------­----------
To unsubscribe, e-mail: users-unsubscribe@w­ebwork.dev.java.net
For additional commands, e-mail: users-help@webwork.­dev.java.net


Add comment
Philip Luppens 7 March 2006 15:36:32 permanent link ]
 Quick note: can't you use <#assign parameters = [ parameters.name1, parameters.name2 ] /> ?
-------------------­--------------------­--------------------­----------
Posted via Jive Forums
http://forums.opens­ymphony.com/thread.j­spa?threadID=21301&m­essageID=41139#41139­

-------------------­--------------------­--------------------­----------
To unsubscribe, e-mail: users-unsubscribe@w­ebwork.dev.java.net
For additional commands, e-mail: users-help@webwork.­dev.java.net


Add comment
Xavier Lepaul 7 March 2006 16:06:32 permanent link ]
 Thanks ! this one work :

<@ww.text theme="hdpsimple" name="${parameters.­name1}"/>
<@ww.text theme="hdpsimple" name="${parameters.­name2}"/>

It still needs more work to add the other optional params, but the idea is here.

(for the reassignment of the whole parameters variable, if I do that I loose all the other data from the hash)
-------------------­--------------------­--------------------­----------
Posted via Jive Forums
http://forums.opens­ymphony.com/thread.j­spa?threadID=21301&m­essageID=41144#41144­

-------------------­--------------------­--------------------­----------
To unsubscribe, e-mail: users-unsubscribe@w­ebwork.dev.java.net
For additional commands, e-mail: users-help@webwork.­dev.java.net


Add comment
Philip Luppens 7 March 2006 16:09:43 permanent link ]
 Aha, but have no fear, Phil is here ! Actually, the freemarker manual is ;-)­

"An extreme usage of assign is when it captures the output generated between its start-tag and end-tag. That is, things that are printed between the tags will not be shown on the page, but will be stored in the variable. For example:

<#macro myMacro>foo</#macro­>
<#assign x>
<#list 1..3 as n>
${n} <@myMacro />
</#list>
</#assign>
Number of words: ${x?word_list?size}­
${x} "

So, just loop through your parameter entries, and add them back
-------------------­--------------------­--------------------­----------
Posted via Jive Forums
http://forums.opens­ymphony.com/thread.j­spa?threadID=21301&m­essageID=41145#41145­

-------------------­--------------------­--------------------­----------
To unsubscribe, e-mail: users-unsubscribe@w­ebwork.dev.java.net
For additional commands, e-mail: users-help@webwork.­dev.java.net


Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > Java Programming > Name parameter redefinition in freemarker 7 March 2006 16:09:43

see also:
discussion forums?
associating contacts with enterprises
OpenCms architecture for web sites
пройди тесты:
see also:
Aaaaaaaaaaaaaa!!!! Where all…
C prazdnikom vcex!
MOJA PYKA

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .