Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleResolver does not handle Lists #37

Closed
beckchr opened this issue Jul 8, 2012 · 1 comment
Closed

SimpleResolver does not handle Lists #37

beckchr opened this issue Jul 8, 2012 · 1 comment
Assignees

Comments

@beckchr
Copy link
Owner

beckchr commented Jul 8, 2012

[Issue migrated from SourceForge | ID: 1575123 | Submitted by 'fesnault']
[http://sourceforge.net/support/tracker.php?aid=1575123]

If you work with SimpleContext and SimpleResolver,

paths with '[]' syntax will not work if the data are

stored in an ArrayList :

" The class 'java.util.ArrayList' does not have the

property '0' "

ListELResolver must be included to have it work.

@ghost ghost assigned beckchr Jul 8, 2012
@beckchr
Copy link
Owner Author

beckchr commented Jul 8, 2012

[Comment migrated from SourceForge | Submitted by 'beckchr']

The default constructor of SimpleResolver is used to create

the EL resolver. This constructor automatically creates a

chain of delegates to resolve bean properties, array

elements, mappled values, etc.

Unfortunately, the resolver to handle list elements is

missing here! This means,

that you won't be able to evaluate ${list[42]}, if variable

'list' refers to a

java.util.List.

To fix this, either wait for the next JUEL release and

replace the jar or -

for juel 2.1.0-rc2 or older - create the chain of resolver

delegates by hand:

CompositeELResolver chain = new CompositeELResolver();

chain.add(new ArrayELResolver());

chain.add(new ListELResolver()); // !!!

chain.add(new MapELResolver());

chain.add(new ResourceBundleELResolver());

chain.add(new BeanELResolver());

ELResolver resolver = new SimpleResolver(chain);

ELContext context = new SimpleContext(resolver);

@beckchr beckchr closed this as completed Jul 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant