Page 1 of 1

RequestContext.getCurrentInstance() gives null

Posted: 13 May 2011, 18:16
by rubi
RequestContext.getCurrentInstance() gives null . Any Idea?

Re: RequestContext.getCurrentInstance() gives null

Posted: 13 May 2011, 22:53
by giberius
I think that only if it started from an Ajax call you will get a value.

The function in the bean was started from a listener? So, perhaps use an attribute ajax="true".

Re: RequestContext.getCurrentInstance() gives null

Posted: 13 May 2011, 23:07
by cagatay.civici
RequestContext is available to ajax requests only.

Re: RequestContext.getCurrentInstance() gives null

Posted: 14 May 2011, 17:38
by rubi
yes its an ajax request. I wrote the statement inside the action method of p:commandButton
I am using weld by the way... does that have any issues?

Re: RequestContext.getCurrentInstance() gives null

Posted: 16 Jul 2011, 10:11
by Clemiou
Hi,

I can observe the same behavior on my components.
But this is not all the times.
Sometimes it works.

When I track the issue with Firebug, I can see that in the wrong cases, the Ajax request is duplicated.
I haven't any solution yet.

Clemiou

Re: RequestContext.getCurrentInstance() gives null

Posted: 06 Dec 2012, 17:35
by Michmich974
Hello,

I dig out this topic because I observed the same behavior but only with IE8.
Sometimes it work, and sometimes not.

And as the previous comment, I can observe that Ajax request is sent twice.
The first sent in fact works correctly, but the second have the RequestContext null.
Is there a fix for this problem?

Regards,
Michmich974

Re: RequestContext.getCurrentInstance() gives null

Posted: 06 Dec 2012, 17:43
by andyba
Michmich974 wrote:Hello,

I dig out this topic because I observed the same behavior but only with IE8.
Sometimes it work, and sometimes not.

And as the previous comment, I can observe that Ajax request is sent twice.
The first sent in fact works correctly, but the second have the RequestContext null.
Is there a fix for this problem?

Regards,
Michmich974
At the bottom of this reply you will see 2 links. Follow the first one, read the Rules you find there and learn them.
Take any and all appropriate actions regarding your signature.

Your question also has no Request Context but not because it is not an AJAX request but because you broke the rules and provided no information which could possibly lead to a solution. Post any question you have in its own thread and don't forget to do what the rules tell you to.