I'm trying to update data in a treemodel but am
getting stale data. Debugging it, I've noticed that
after a form is submitted on the page that the tree
resides on, the FacesServlet will restoreView first,
then process any actionListener attached to the form
submit, and finally render the page.
The data that fills my tree (request managed-bean) is
persisted in a database and is refreshed during this
restoreView call. My actionListener (in this case an
update to the data) is fired next. Finally the new
page gets rendered. Here's where the problem is.
The line quoted below from HtmlTreeRenderer.java gets
the current value of HtmlTree. tree.getValue() is the
value that should be rendered. What does get rendered
is tree, which contains the treemodel from
restoreView().
public void encodeChildren(FacesContext context,
UIComponent component) throws IOException
{
HtmlTree tree = (HtmlTree)component;
boolean showRootNode = getBoolean(tree,
JSFAttr.SHOW_ROOT_NODE, true);
if (!component.isRendered()) return;
if (tree.getValue() == null) return; <-- this
line 160.
Should the value of tree.getValue() get used instead?
Or am I wrong? I'm currently working around this by
trashing the tree bean to force a refetch.
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/