Board index JavaServer Faces General RequestContext.getCurrentInstance() gives null

RequestContext.getCurrentInstance() gives null

Components, Ajax Framework, Utilities and More.


Posts: 160
RequestContext.getCurrentInstance() gives null . Any Idea?
Glassfish V3.1.1,Mojarra 2.1.2, PrimeFaces-3.0RC1


Posts: 39
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".


Posts: 14908
Location: Cybertron

RequestContext is available to ajax requests only.
PrimeFaces Lead


Posts: 160
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?
Glassfish V3.1.1,Mojarra 2.1.2, PrimeFaces-3.0RC1


Posts: 10
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


Posts: 2
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
Regards,
Michmich974
PF v3.2, PF ext v0.5.1, Tomcat 6.0.35

andyba User avatar
Expert Member

Posts: 1988
Location: Steinfeld, near Bremen/Osnabrück, DE

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.
PF 3.4.2, PF 3.5.10, PF 4.x (Elite versions)
Glassfish 3.1.2.2, Mojarra 2.x, under both Java 6 and Java 7.
If you haven't read the forum rules read them now
My blog: http://onthefaceofthings.blogspot.de/
PrimeFaces Project


Return to General