Nested message parameters and EL expressions
by Gunnar Morling
Hi,
I came across an interesting case in the HV user forum [1], where a user is
essentially nesting messages parameters within an EL expression:
${validatedValue > someValue ? '{x.y.z.message}' : '{x.y.w.message}'}
The expectation is that at first the two message parameters are resolved
and then based on the conditional expression the outer EL expression either
resolves to one message or the other.
This is currently not supported in HV, but reading the interpolation
algorithm in the spec [2] I can't find anything indicating that this case
would prohibited. On the other hand I'm not sure whether we intentionally
meant to support it (at least it never occurred to me); if so, I think we
should provide an example for this in the spec.
The use case seems valid to me, also for cases where one wants to refer to
constraint attributes in conditional logic. Any thoughts?
--Gunnar
[1] https://forum.hibernate.org/viewtopic.php?f=9&t=1029782
[2] http://beanvalidation.org/1.1/spec/#default-resolution-algorithm
11 years