On Fri, 26 Oct 2012 17:38:22 -0200, Ken in Nashua <[email protected]>
wrote:
Folks,
Hi!
Does anyone know about this kind of thing???
I got properties... and yes I like to initialize my stuff. Question is
where and will initialization interfere if my properties are persistent.
Answer: when you change the value of a @Persist'ed field, regardless of
when or where, it is changed in the HTTP session.
So far I got these...
@SetupRender
public void setupRender()
{
itemsPerPage = 10;
tableColumns = 3;
}
But everytime page cycles thru my persistent properties get clobbered
back to what this initializes them to. And everything gets whacked back
to what setupRender says.
That's expected behavior. Your code above writes to the persisted fields
every time your component or page is rendered. Just check whether the
fields were initialized before setting them again.
@Persist
private Integer items;
public void setupRender() {
if (itemsPerPage == null) {
itemsPerPage = 10;
}
...
}
By the way, as your method is named setupRender(), it doesn't need to
@SetupRender annotation.
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]