You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Huber <gr...@gmail.com> on 2013/08/08 09:45:26 UTC
won't show tags on a pojo object
Hello,
There is probably not much you can do on this one, but I thought I would
post it if someone else was having the same issue.
I was trying to iterate over a pojo and it was not rendering the tags at
all. I trace the source and found that on my pojo I had a method called
getTheme() which returned a WebsiteTheme class used in my webapp:
/**
* Get the Theme object in use by this website, or null if no theme
* selected.
*
* @return the theme
*
* @throws EventsException
* the events exception
*/
@Transient
public WebsiteTheme getTheme() throws EventsException {
// let the ThemeManager handle it
ThemeManager themeMgr = Controller.getThemeManager();
return themeMgr.getTheme(this);
}
On class org.apache.struts2.components.UIBean there is a method getTheme()
: where is searches via ongl : stack.findString("#attr.theme"); for a
method #attr.theme ie getTheme()
public String getTheme() {
......
// If theme set is not explicitly given,
// try to find attribute which states the theme set to use
if ((theme == null) || (theme.equals(""))) {
theme = stack.findString("#attr.theme");
}
......
}
Unfortunately it found the one on my pojo even though the return type was
not a String. The solution is to either remove the getTheme() on the pojo,
or to specify the default theme on all the tags within the
<s:iterate><s/:iterate>.
Cheers Greg.