History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-1069
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Patrick Lightbody
Reporter: Grégory Joseph
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
WebWork

Ability to use freemarker map built-ins (?keys, ?values) as well as plain map methods (.keySet(), get(foo))

Created: 06/Jan/06 08:15 PM   Updated: 07/Jan/06 05:25 PM
Component/s: Views
Affects Version/s: 2.2
Fix Version/s: 2.2

File Attachments: 1. File maps-methods-AND-builtins.tgz (3 kb)


Flags: Patch


 Description  « Hide
The problem comes from FreemarkerManager calling
        beansWrapper.setSimpleMapWrapper(false);
This makes the hash builtins ( http://freemarker.org/docs/ref_builtins_hash.html ) unavailable, but makes plain method calls possible. Setting this to true makes builtins available, but no method calls possible.

Here's a patch that allows both.

See the test case to see how it currently fails and how this solves it, while retaining the ability to use plain method calls on the maps.

 All   Comments   Change History      Sort Order:
Grégory Joseph - [06/Jan/06 08:38 PM ]
The TestCase was done with jmock, because i did not manage to just stub the servlet stuff (context, request, response) out with easymock.

However, you'll see these stubs are not really needed : the main assert method (asserting a template's result equals expected text output) calls a second one which does the same test but using FreemarkerManager, and it's only there those stubs are used. That part of the test is useful - just to avoid regression if one modifies the way FreemarkerManager handles the WWBeanWrapper for instance), but might be more an IT than UT ?

Let me know what you think.

Patrick Lightbody - [07/Jan/06 05:25 PM ]
Committed and documented.