aspose file tools*
The moose likes Struts and the fly likes struts2: select tag and parameters property of bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2: select tag and parameters property of bean" Watch "struts2: select tag and parameters property of bean" New topic
Author

struts2: select tag and parameters property of bean

Pavel Kazlou
Ranch Hand

Joined: Sep 07, 2009
Posts: 33
I have a base class ReportElement which has type property:



ReportElementType is just an enum with specified code and i18nKey properties for each element. I have a couple of subclasses of ReportElement, each of them introducing their own properties. One of them is Plot:


On some page I needed to display a collection of different ReportElement instances, so I just used struts2 select tag:



This worked like a charm for every element except for Plot instaces. Instead of invoking getType().getCode() or getType().getI18nKey() plain toString() was invoked on every instance of Plot! After several hours of fun debugging I noticed that during tag evaluation Plot's getParameters() method is called! So it seems struts was trying to evaluate type.code and type.i18nKey using getParameters() method! Failing to do that it ignored the existence of the properties, that I have clearly specified for usage!

After renaming getParameters to a kind of odd name like getParamms the problem gone. Also the problem with evaluating ognl wasn't spotted when using iterator tag together with property tag.

Does anyone have an idea WHY struts uses parameters property of my bean, when I have clearly specified what property should be used? Is it some "cool" feature or a bug?

P.S. I use struts 2.2.3.1
Pavel Kazlou
Ranch Hand

Joined: Sep 07, 2009
Posts: 33
Found corresponding issue in struts JIRA: https://issues.apache.org/jira/browse/WW-3268

2.3 is specified as fix version.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts2: select tag and parameters property of bean