Questions tagged [facescontext]

This tag denotes the FacesContext class which is part of the Java Server Faces (JSF) model view presenter framework. It is used to permit disambiguation with the deprecated generic [context] tag.

This tag denotes the FacesContext class which is part of the Java Server Faces (JSF) model view presenter framework. It is used to permit disambiguation with the deprecated generic tag.

See Also

See the main information on .

112 questions
36
votes
4 answers

What is FacesContext used for?

What is FacesContext used for? And where exactly is it implemented?
meenus
  • 453
  • 1
  • 5
  • 9
31
votes
1 answer

What is the difference between FacesContext and ExternalContext

What is the difference between FacesContext and ExternalContext? When can I use one or other? What has the one and what has the other? The following sample is from the book JavaServer Faces 3rd edition:
vmaric
  • 369
  • 1
  • 4
  • 14
21
votes
7 answers

Mocking FacesContext

I am trying to add some unit tests to a JSF application. This application didnt rely heavily on any best practices, so many service methods use the FacesContext to pull data from managed session beans like so: (this is inside a util class) public…
mkoryak
  • 57,086
  • 61
  • 201
  • 257
13
votes
1 answer

How do I retrieve the FacesContext within a Filter

How do I retrieve the FacesContext within a Filter? I followed following article on how to retrieve the FacesContext in a Filter: http://ocpsoft.org/java/jsf-java/jsf-20-extension-development-accessing-facescontext-in-a-filter/ But the problem is…
djmj
  • 5,579
  • 5
  • 54
  • 92
12
votes
1 answer

How to use FacesContext.getCurrentInstance(), it returns null

I've been struggling for the last couple of days with the login part of my web app. I've gotten to the point where I can succesfully authenticate a user using the JDBCRealm on tomcat(by reading users from a sql server database). Now I want to send…
Andrei Dvoynos
  • 1,126
  • 1
  • 10
  • 32
7
votes
4 answers

Access JSF and Primefaces version numbers programmatically

I use PrimeFaces 3.5.x and Mojarra JSF 2.1.x I would like to access and show the versions of both libraries programmatically. I use the versions as maven2 properties, but I hope there is an easier way to get the versions. I hope to find something…
alfonx
  • 6,936
  • 2
  • 49
  • 58
7
votes
1 answer

Lifecycle of FacesContext?

While going through the javadoc of FacesContext, I came across this sentence The instance remains active until its release() method is called, after which no further references to this instance are allowed. While a FacesContext instance is active,…
Ullas
  • 837
  • 3
  • 10
  • 14
6
votes
1 answer

FacesContext.getCurrentInstance() returns null in Runnable class

I am trying to get the FacesContext by calling FacesContext.getCurrentInstance() in the run() method of a Runnable class, but it returns null. public class Task implements Runnable { @Override public void run() { FacesContext…
Elena
  • 145
  • 4
  • 13
5
votes
1 answer

how to mock FacesContext with JMockit, All the tests fail with NullPointerException

All the junit tests fail with NullPointerException when the bean uses FacesContext or creates an object of a class which uses FacesContext. Please suggest a way to test the code with junit. Bean @ManagedBean(name =…
user1926688
5
votes
1 answer

java.lang.RuntimeException Cannot find FacesContext

I don't know how to continue, but I always get the "java.lang.RuntimeException: Cannot find FacesContext" for my new JSF 1.2 web application. I'm sure it's just some configuration I can't find. The exception occurs with the first f: or h: tag.…
Philipp
  • 4,645
  • 3
  • 47
  • 80
4
votes
2 answers

Getting the current global messages from FacesContext

I have a problem. I need to know whether my page has global errors or not. This is because I have 2 different h:messages (error containers)
cesaregb
  • 765
  • 1
  • 11
  • 27
4
votes
1 answer

How do I mock a JSF FacesContext with a ViewMap for Unit Tests outside an actual web application?

EDIT: Cleaned up the question for readability. Please ignore comments up to October 31st. In our application stack we work with many smaller jar modules that get combined into a final web application. One module defines JSF features, like…
Pete
  • 10,720
  • 25
  • 94
  • 139
4
votes
1 answer

java threadlocal singleton - what is it?

In layman speak, what does it mean when somebody says an object is a threadlocal singleton in Java? I was at a lecture about Java Server Faces, and everytime the FacesContext was spoken of - the instructor always reminded us that it is a threadlocal…
juice john
  • 41
  • 2
4
votes
1 answer

How to inject FacesContext with JSF 2.3 and TomEE?

I've been trying to use JSF 2.3 with TomEE server and I'm having problems using the @Inject annotation with the FacesContext object. When I use it, i get the following exception while starting my TomEE server: SEVERE: CDI Beans module deployment…
4
votes
1 answer

How to resolve JSF1095 Flash Warning "Response already committed" in f:selectItems component?

I meet a strange behavior with JSF 2.4 on Mojarra. I'm using flash parameters to pass from a page to another. Each time i arrive on a new page, i retrieve my flash parameters in Postconstruct annoted method. Then if the page is refreshed, the user…
ZheFrench
  • 1,164
  • 3
  • 22
  • 46
1
2 3 4 5 6 7 8