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.
112
questions
0
votes
0
answers
13
views
Using JSF websockets in an asynchronous context [duplicate]
I have a JSF Application and want to use websockets to send messages to the webclient.
On the server side I'm executing some long-running asyn tasks, I perform it using the @Asynchronous annotation
...
1
vote
1
answer
383
views
How to use resolveWidgetVar before PrimeFaces 8?
https://github.com/primefaces-extensions/primefaces-extensions/blob/master/core/src/main/java/org/primefaces/extensions/renderer/CommandButtonSingleClickRenderer.java
This appears to be an elegant ...
0
votes
0
answers
43
views
Regularly Sent API Requests from a JSF/EJB Application
I have some API requests generated on a schedule.
I can't use JSF CDI beans as they do not have a schedule or timer function.
I cant use a scheduler in stateless EJB as it can not access FacesContext ...
0
votes
1
answer
74
views
Sending UTF-8 message to Xpages
I have an XPages application for Swedish users.
When I am sending a message to the facescontext via
msg = propStrings.getProperty("gen_CustDateDecided") ;
FacesContext facesContext = ...
0
votes
2
answers
433
views
How to get string query params from URL in Domino
After some time I managed to make a redirect from some API.
However, now I'm facing a different problem.
It seems, that there's just no way to get a query param from URL.
The button looks like ...
0
votes
0
answers
1k
views
How to Fix Null Pointer Exception for FacesContext in ORACLE-ADF
I am using this library https://github.com/marksh222/universalTaskFlow/blob/master/Rcore/Global/src/com/rcore/global/jsf/JSFUtils.java for my backing bean which is defined in my task flow with "view" ...
0
votes
0
answers
89
views
Focus not working in Chrome when set from FacesContext
Am focusing element from server side using FacesContext like below,
FacesContext fc = FacesContext.getCurrentInstance();
fc.getExternalContext().getRequestMap().put("focus", "addform:elementid");
...
3
votes
1
answer
5k
views
FacesContext not injectable in Wildfly 14 with JSF 2.3 (Mojarra, main module)
I have a bean:
import javax.faces.context.FacesContext;
import javax.faces.view.ViewScoped;
...
@Named
@ViewScoped
public class SimpleBean implements Serializable
{
private static final long ...
2
votes
1
answer
234
views
FacesContext.getCurrentInstance() throwing java.lang.VerifyError: Inconsistent stackmap frames at branch target exception
I already checked other stackoverflow answers but none of them had an answer for JSF facescontext so I had to put a question.
We had jdk 6, jsf 1.2 and mySQL 5.5 and now we have upgraded to java 8 and ...
0
votes
1
answer
93
views
Disable button not calling java method correctly?
I am having some trouble calling my java method. So, I have button in my front end in jsf. Where, I am calling my java method to disable 2 factor, I have sql procedure as well. Can any one check my ...
1
vote
0
answers
83
views
Java HttpServletRequest.getRequestURL() don't deliver the calling url
I have a problem to get the calling URL,
For example, I call "www.xyz.de/abc", the urlrewite.xml change it to "www.xyz.de/test.jsp" to call the correct JSP.
In the bean, I want to get the calling ...
4
votes
1
answer
1k
views
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 ...
2
votes
1
answer
710
views
Add JSF Message From Spring Bean
I'm having problem with adding message to FacesContext from Spring component. Here is the senario:
User logins from .xhtml page
Spring Security authorize user
If user success/failed, return message ...
0
votes
1
answer
1k
views
Which is the better way to access pageflowscope variable in ADF
As we know there are multiple ways to access the page flow scope variable but which one is the right one?
ex RequestContext.getCurrentInstance().getPageFlowScope();
AdfContext.getCurrent....
1
vote
1
answer
60
views
Not getting request parameters in @RequestScoped ManagedBean
I have one JSF page and have a Managedbean associated with it.
My xhtml page looks like this:
<h:head>
</h:head>
<h:body id="configuratorWrapper">
<h:form method="post" id="...
0
votes
0
answers
163
views
uploading file on the server by clicking on generateFile and return a link to download jsf
Jsf : how can i upload file to the server without having upload button .??
i have a genarate Excel File button.
how can i upload it to the server just by clikcing the Excel file Button and return a ...
2
votes
1
answer
324
views
When should I use UIComponent#popComponentFromEL(FacesContext context)?
I'm working on an existing JSF component where the encodeEnd method ends with:
// popComponentFromEL(context);
The Javadoc for UIComponent#popComponentFromEL(FacesContext context) tells me:
Pop ...
0
votes
1
answer
400
views
Primefaces: pagination elements in FacesContext
I need help. If someone can help I would be grateful.
I have a Datatable with pagination and I want to have Pagination data from paginatorTemplate (RowsPerPageDropdown and CurrentPageReport) outside ...
1
vote
0
answers
691
views
FacesContext.getCurrentInstance().getExternalContext().getContextName() returning null in WildFly 10.0.0
I'm trying to get the relative address of my view via the function
FacesContext.getCurrentInstance().getExternalContext().getContextName()
It works fine in Payara 4.1, however, the same code in ...
0
votes
1
answer
719
views
Trying to set and get attribute from one class to another via a 3rd class in JAVA
I have a bean class which looks like this
@ManagedBean(name = "usingBean")
@SessionScoped
public class UserInfo implements Serializable {
private static final long serialVersionUID = ...
0
votes
0
answers
41
views
How can I captured an exception and show its in context message? [duplicate]
I have a exception on Usuario usuario = gestionUsuario.hacerLogin(nombre, clave); and I want capture the exception and show its in a context message. I implemented the next code, but the application ...
0
votes
0
answers
113
views
FacesContext return wrong value
in login method i stored the connected user in FaceContex to use it in others managedbeans the problem that when i run this method:
User connectedUser = (User) FacesContext.getCurrentInstance()....
1
vote
2
answers
538
views
How to get portlet init parameters in a JSF Portlet using FacesContext
I have got the following code to get a portlet init parameter "javax.portlet.faces.defaultViewId.view" from FacesContext.
FacesContext fc = FacesContext.getCurrentInstance();
ExternalContext ...
0
votes
2
answers
9k
views
FacesContext.addMessage() does not show message in p:messages [duplicate]
i have a managed bean with a method that add a message like this:
@ManagedBean
@ViewScoped
public class FileMB implements Serializable{
private static final long serialVersionUID = -...
3
votes
0
answers
5k
views
Critical error during deployment: : com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null
Hi I'm migrating my application from Websphere to Jboss and I'm getting below error while deploying my EAR. I would really appreciate if anyone could hint the error.
I'm also getting error stating ...
1
vote
1
answer
569
views
FacesContext in a @WebListener
I need build some jsf urls in a @WebListener.
I thought I could use a snippet of code like this one
final FacesContext currentInstance = FacesContext.getCurrentInstance();
final String ...
0
votes
1
answer
1k
views
FacesContext.getCurrentInstance returns null in PrimeFaces Dialog Framework demo
I want to run the ShowCase demo of Dialog Framework - Data on GlassFish 4.1 and NetBeans 8.0.2. I Copy/Paste code from showcase. But I encountered a NullPointerException on this line:
FacesContext....
0
votes
4
answers
562
views
How to set a user defined language in Xpages
In my xpage I need to set a user defined language before the page loads. the language to be set is stored in a document in the database
so I do this in beforePageLoad
var lang = getUserDoc()....
-1
votes
1
answer
141
views
why exist initContextServletContext in JSF Mojarra 2.2 FacesContext.java
private static ConcurrentHashMap initContextServletContext = new ConcurrentHashMap(2);
field is private, but never used in FacesContext class. Is there a reason to exist?
0
votes
0
answers
135
views
Missing FacesContext inside @WebServlet #doGet(...) [duplicate]
I have some bean using the @WebServlet annotation:
@WebServlet("tools/httpProjectLoader.xhtml")
public class HttpProjectLoader extends HttpServlet {
@Override
protected void doGet(...
0
votes
1
answer
760
views
Access FacesContext in xAgent (in new Thread)
I am planning to use single entry point for all 5 minutes xAgents, meaning one XPage launchs all 5 minutes "java agents" (classes that should be launched every 5 minutes). I would like to lauch that ...
1
vote
0
answers
1k
views
What might be the reason for JSF/MyFaces to lose its FacesContext?
I have a webapplication based on JSF(2.1.17) myfaces /PrimeFaces + Omnifaces on WAS 8.0.0.9
Most of the time everything works ok, but occasionally I get the following exception:
java.lang....
0
votes
1
answer
602
views
CDI injection - NPE of FacesContext when using Deltaspike @scheduled
I'm using a Deltaspike (1.4.0) with Quartz (2.2.1) to schedule a job.
In the TestJob bean is injected ResourceBundle. The producer of ResourceBundle needs a facesContext, but this always is null.
...
3
votes
1
answer
8k
views
Howto get @Service instance in Spring programatically
I need to implement javax.faces.convert.Converter to convert String-to-Object and Object-to-String.
To do so, I have defined specific services (@Service), but I do not know how to get an instance.
...
5
votes
1
answer
940
views
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
@...
0
votes
2
answers
1k
views
What is the easiest way to get an LDAPContext from a FacesContext?
I've got a Java doLogin() method invoked from a JSF page that gets an id (String netId) and password (String password) from the user. doLogin() initiates the authentication using netId as the ...
0
votes
0
answers
881
views
Trying to retrieve the user from session with FacesContext
I'm currently trying to retrieve all the data from the user that is logged in so I can use it for example listing his emails or his contacts, or to can modify or add new ones.
At the beginning, in ...
2
votes
1
answer
2k
views
FacesContext.getCurrentInstance() returns null even in managed bean thread
I have a fairly standard archirecture where a PrimeFaces page calls a login action in a class annotated with javax.inject.@Named and javax.enterprise.context.@SessionScoped.
The doLogin() method ...
1
vote
2
answers
2k
views
How to access the navigation-case of the faces config from a Java class
I have this situation, where I have to access the entire faces config from a managed beans. More specifically, I need to access the list of navigation cases, that were specified in the faces-config ...
3
votes
1
answer
2k
views
Difference between by Application#getResourceBundle() and ResourceBundle#getBundle() in JSF 2.0
In order to retreive Strings from the resourse bundle, i am trying to compare the result from this two methods, below an example for the code:
First Example:
baseName: The fully qualified name of ...
2
votes
2
answers
3k
views
Mock FacesContext to test my faces message displayer class
My Backing bean:
@ManagedBean(name = "messageDisplayer")
@ViewScoped
public class MessageDisplayer implements Serializable
{
private final Logger LOGGER = LoggerFactory.getLogger(this....
3
votes
1
answer
1k
views
FacesContext instance is null in ApplicationScoped Managedbean
I created a ApplicationScoped bean that have a PostConstruct method named start.
Whenever i want to get instance of FacesContext in the start method and it returns null:
@ManagedBean
@...
0
votes
1
answer
52
views
Adding message to faceContext is not working in Java EE7 run on glassFish?
I am doing the tutorial on Java EE7 that comes with glassFish installation. It is also available here. The code is present in glassFish server installation directory
/glassFish_installation/...
0
votes
1
answer
72
views
How to test this sortingBean using FacesContext
I wrote myself aSortingBeanwhich is similiar to theCarsSortingBeanover here. I want to write a unit test for this class but I don't know how to do this. I got problems with the first line of the sort ...
0
votes
1
answer
2k
views
Get Application Module during invocation of Bounded Taskflow
I have a filter which maps just before the Faces Servlet and populate some Attributes in the HttpSession before it proceeds with the request
if (_clientUser != null && !_clientUser.isEmpty())...
3
votes
1
answer
3k
views
Why jsf life cycle skips render response after Invoke application when redirect the page?
I have two scenario
I have two actions which have logic in bean like
My buttons
<h:commandButton value="Submit" action="#{bean.test}" />
<h:commandButton value="Submit" action="#{bean....
-1
votes
1
answer
3k
views
add message to growl message componnent in primefaces
hello i have a jsf page it contains a message and a i want add message only to the growl message and it does not work for me :
my java code is :
public class EtudeBean {
privaezte loneeg ...
0
votes
1
answer
152
views
Reading a parameter from web.xml in another package to init a view
To get a init parameter from same package, I can make it:
in web.xml
<context-param>
<param-name>PARAM</param-name>
<param-value>1</param-value>
</context-...
0
votes
2
answers
2k
views
Faces in ADF can't get the request parameters
I have an ADF web application with Faces 1.2
In my managed bean I am trying to access the parameters of the post request, but always getting null.
This is my post form that I am posting to the ...
1
vote
2
answers
2k
views
Trouble with ADF project call from external application
I have an ADF project using jdeveloper with name ADF1 and has a self authentication with the welcome page login.jspx and its backing bean backing_login.java.
Now I need to use another application ...