Re: Putting Value in map.
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Wednesday, July 15, 2009, 8:15:34 AM, Chirag Manocha wrote:
> I want to set key/value in parameters map while iteration of a list.
> Is there any way to do :-
> parameters.put("name", "Chirag");
If the ObjectWrapper exposes the "put" method of the Map object, you
can directly call it with <#assign ignore = parameters.put("name", "Chirag")>
(where #assign was used as ${parameter.put("name", "Chirag")} would
print the return value of put). Another (usually cleaner) solution is to
write a TemplateDirectiveModel for that purpose, so you can just write
<@setParameters name="Chirag" />.
But at least if "parameters" is the HTTP request parameters, it feels
like you try to do a dirty solution here... Ideally, an MVC template
shouldn't fiddle with HTTP request parameters at all, not to mention
modifying them. Maybe you should do more processing outside the
templates, especially before processing them (i.e., prepare the
data-model more).
> Any pointer will be high appreciable. Thanks in Advance
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge