Questions tagged [externalcontext]
9 questions
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
2
votes
1 answer
ExternalContext#getResourceAsStream() returns null, where to place the resource file?
I'm trying to obtain a PNG file as InputStream in my managed bean as below:
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
InputStream input = externalContext.getResourceAsStream("/myFile.png");
// input is…

Lukas Novicky
- 921
- 1
- 19
- 44
0
votes
1 answer
Difference between @ManagedProperty and FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("bean")
What's the difference between:
public class GameController implements Serializable{
@ManagedProperty(value="#{Gamebean}")
private Game game;
and
public class GameController implements Serializable{
private Game game;
public…

gastonovic
- 35
- 1
- 3
0
votes
1 answer
Not Found in ExternalContext as a Resource
I have a maven projet on Eclipse Luna.
My application deploys normally on tomcat 7 but when I try to access it some of the primefaces resources are not loaded and I get this exception:
GRAVE: Servlet.service() for servlet [Spring MVC Dispatcher…

Daniel
- 273
- 4
- 18
0
votes
1 answer
FacesContext....redirect(page) : how to redirect with data ?
Can someone tel me how to redirect with data, by the following redirect method:
FacesContext.getCurrentInstance().getExternalContext().redirect("page1.xhtml");
I have some strings "regNo" which I want to send. Also, do let me know how I receive it…

user2746713
- 3
- 1
- 6
0
votes
1 answer
how jsf get server url
all
My web project run in tomcat.Its path ishttp://localhost:8080/test/index.html.
How to get the url = "http:/localhost:8080/test/" throught ExternalContext?
thanks advanced.

wilson
- 281
- 6
- 22
0
votes
0 answers
How to redirect desktop page to mobile page using ExternalContext
Project structure:
root
-WebContent
-mobile
-login.xhtml
-desktop
-login.xhtml
My web.xml will load desktop/login.xhtml onload which uses UserBean as a backing bean, In postconstruct of UserBean, I'm trying to redirect my login…

FiendFyre
- 157
- 3
- 17
-1
votes
1 answer
How do i redirect result(Which will have some data of request and response) to another jsf page using ExternalContext?
public void handleRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
logger.debug("Entering in DirectPayPaymentResponseHandler handleRequest() method");
…

Suyash
- 331
- 1
- 4
- 20
-2
votes
2 answers
in a Java MicroServices System where locate the error check?
I have a controller that receives a request, passes the data to the service and the service makes an external http call, the answer is returned to the service and then the controller returns a web page.
An error message or an exception could come…

Vito Lipari
- 795
- 8
- 35