myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Bashan <guy.bas...@gmail.com>
Subject Bean created twice
Date Sat, 07 Jun 2008 10:21:36 GMT
Hi All,

 

I am having a weird problem that I cannot understand.

I have a pretty complex screen, with one big datatable and more nested
datatables.

Behind the screen there is a request scope bean.

Each nested table brings different types of information (This information is
stored in a session scope bean, but I don't think it matters to the
problem).

Some of the nested tables brings list of keywords and on the top of each
table there is inputText with command button saying "add new keyword".

Now, there are times when I press "add new keyword" it adds the keyword
twice (buy using debug I see the action called twice). I tried to make a
workaround using a Boolean variable that will prevent from action to be
called twice, but it didn't work. So I added a log in the bean constructor
and noticed that the bean is simply created twice (and so the action is
activated twice causing the session variable holding data to have the data
twice).

 

And another weird problem:

In the bean constructor I initialize some object by doing:

Integer campaignId =
getRequestParameterAsInteger(RequestParamNames.CAMPAIGN_ID);

cmpCampaign = DAOFactory.getCampaignDAO().getCmpCampaign(campaignId);

 

I noticed that there are times (it is completely inconsistent), that I get
exception because:

getRequestParameterAsInteger(RequestParamNames.CAMPAIGN_ID); return null
(even that I have a hidden field holding a proper value).

The " getRequestParameterAsInteger" is a method that simply gets the value
from the request parameters and converts it to integer.

I also wrote a code in the exception that will output all request parameters
and it returns no parameters though I have some more hidden fields.

 

When this exception happens, the bean is created about 10 times.

 

By the way the screen is working properly and loaded fine, because probably
eventually the bean is created and the request parameter is being fetched
properly.

 

Have anyone encountered such unexpected behavior?

 

Thanks,

Guy.


Mime
View raw message