Hi,
> parameters.multi. When specifying a name attribute for <html:link>
> that doesn't resolve to a Map you'll get an IllegalArgumentException in
> java.text.MessageFormat instead of the actual error message.
while I'm at it... The reason that I actually stumbled across this was that I
was trying to append the properties of a bean to the link parameters.
Now I'm curious whether it would be possible to extend the functionality of
RequestUtils to also handle this case.
I've attached a diff that should illustrate this and so far seems to work for
me. (Although I'm not sure about the exception handling.)
Have a nice day
Daniel Temme
Index: RequestUtils.java
===================================================================
RCS file: /home/cvspublic/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
retrieving revision 1.23
diff -u -r1.23 RequestUtils.java
--- RequestUtils.java 2001/10/16 15:48:28 1.23
+++ RequestUtils.java 2001/11/13 16:37:44
@@ -191,9 +191,21 @@
// Locate the Map containing our multi-value parameters map
Map map = null;
try {
- if (name != null)
- map = (Map) lookup(pageContext, name,
- property, scope);
+ if (name != null) {
+ Object lookup = lookup(pageContext, name,
+ property, scope);
+ if (lookup instanceof Map)
+ map = (Map) lookup;
+ else
+ try {
+ map = BeanUtils.describe(lookup);
+ } catch (Exception e) {
+ saveException(pageContext, e);
+ throw new JspException
+ (messages.getMessage("parameters.multi", name,
+ property, scope));
+ }
+ }
} catch (ClassCastException e) {
saveException(pageContext, e);
throw new JspException
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>