Questions tagged [jsf-2.2]

JavaServer Faces 2.2 is the major JSF upgrade that's part of Java EE 7. It has some significant new features like task flows (Faces Flow), a stateless mode, basic theming (resource library contracts), build-in HTML5 support and a much improved "bare HTML" mode (passthrough elements). Starting from this version, JSF formally supports CDI and for some features even depends on CDI.

Filter by
Sorted by
Tagged with
35votes
2answers
36kviews

How to install and use CDI on Tomcat?

I'm creating my first project Java EE 7, but I'm having trouble. Appreciate any help. Tomcat 7.0.34 JSF 2.2 Primefaces 3.5 javaee-api-7.0.jar When the application start, the Tomcat log shows the ...
user avatar
30votes
1answer
5kviews

JSF 2.2 Memory Consumption: Why does Mojarra keep the ViewScoped Beans of the last 25 Views in Memory?

Memory per Session grows We are experiencing high memory consumption using JSF 2.2 (2.2.12) with Mojarra. After investigating our load tests, it turned out that the size of data in our ViewScoped ...
user avatar
  • 3,242
29votes
5answers
56kviews

File upload doesn't work with AJAX in PrimeFaces 4.0/JSF 2.2.x - javax.servlet.ServletException: The request content-type is not a multipart/form-data

Important : The issue which is discussed in this thread has been fixed as of PrimeFaces 5.1 final (community release) released on Monday, October 6, 2014 (just a few minutes ago from now). I attempted ...
user avatar
  • 25.8k
26votes
6answers
60kviews

Using a "Please select" f:selectItem with null/empty value inside a p:selectOneMenu

I'm populating a <p:selectOneMenu/> from database as follows. <p:selectOneMenu id="cmbCountry" value="#{bean.country}" required="true" ...
user avatar
  • 25.8k
25votes
3answers
33kviews

JSF 2.2 faces-config: Unknown Schema version: 2.2

I'm trying to use the Faces 2.2. I get an error. SEVERE: Critical error during deployment: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: com.sun.faces.config....
user avatar
19votes
3answers
116kviews

Target Unreachable, identifier resolved to null in JSF 2.2 [duplicate]

I have a problem with JSF 2.2 and CDI, my managerbean is not solved and this error appear "value="#{userBean.user.name}": Target Unreachable, identifier 'userBean' resolved to null" This is my ...
user avatar
  • 480
18votes
1answer
58kviews

How to upload file using JSF 2.2 <h:inputFile>? Where is the saved File?

I would like to be able to upload files in my JSF2.2 web application, so I started using the new <h:inputFile> component. My only question is, how can I specify the location, where the files ...
user avatar
  • 272
17votes
1answer
19kviews

Pass an object between @ViewScoped beans without using GET params

I have a browse.xhtml where I browse a list of cars and I want to view the details of the car in details.xhtml when a "View more" button is pressed. Their backing beans are @ViewScoped and are called ...
user avatar
  • 3,449
16votes
2answers
17kviews

How to access enum properties in EL?

Given the following enum. public enum Constants { PAGE_LINKS(10); //Other constants as and when required. private final int value; private Constants(int value){ this.value = ...
user avatar
  • 25.8k
15votes
1answer
14kviews

When to use preRenderView versus viewAction?

When should one use the preRenderView event to initialize data for a page versus using the viewAction? Are they equal in use and do they have the same effect? preRenderView Event <f:metadata> ...
user avatar
15votes
1answer
15kviews

Execute JavaScript before and after the f:ajax listener is invoked

It there an easy way to invoke a JavaScript action before and after the invocation of an <f:ajax listener>, e.g. I'd like to invoke window.alert("pre") before and window.alert("post") after ...
user avatar
14votes
3answers
12kviews

How can I upload multiple files with JSF 2.2

I am trying to add a multiple file upload using h:inputFile. I had a quick look through the source code and it appears that it does not have the option to render multiple="multiple". Is there a way ...
user avatar
13votes
3answers
15kviews

Which XML namespace to use with JSF 2.2 and up

I have migrated my application from JSF 1.2 to 2.2. It used XML namespaces on java.sun.com domain like xmlns:f="http://java.sun.com/jsf/core". However, Oracle's Java EE 7 tutorial is using XML ...
user avatar
13votes
3answers
9kviews

Populate p:selectOneMenu based on another p:selectOneMenu in each row of a p:dataTable

I have a <p:dataTable> with lazy load. In two of the columns, there is a <p:selectOneMenu> in each of them. The first column holds a list of countries and the second one holds a list of ...
user avatar
  • 25.8k
13votes
1answer
4kviews

Call order of h:commandLink action and f:ajax listener

Here is my markup: <h:commandLink value="#{partial}" action="#{hello.setCurrentPartial(partial)}"> <f:ajax render="include" listener="#{hello.renderFragments}"/> </h:commandLink&...
user avatar
  • 6,423
12votes
1answer
7kviews

Should <protected-views> be used for JSF 2.2 CSRF protection?

I am confused. I see that JSF 2.0 has implicit CSRF protection: How JSF 2.0 prevents CSRF On the other side according to the article http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/JSF-...
user avatar
  • 9,501
12votes
1answer
214views

How to disable "[cdata]" surround for html tags in xhtml files in IntelliJ?

When I type in xhtml files IntelliJ only autocomplete JSF options and no html option. If a write "div" and press tab, it replace by <![CDATA[ <div></div> ]]> Any option ...
user avatar
11votes
1answer
11kviews

@ViewScoped bean recreated on every postback request when using JSF 2.2

I'm having an issue similar to this post and the answer from @BalusC with 3 solutions but: I'm not using of the mentioned EL expressions I don't want to go with the second solution (it's complex ...
user avatar
  • 437
11votes
2answers
23kviews

How to write a file to resource/images folder of the app?

I would like to upload an image and store it on the server, and later to show it with h:graphicImage? I would like to store it in "resources/images" of the app. I am using glassfish 4. Right now, the ...
user avatar
  • 1,168
11votes
1answer
4kviews

When using @EJB, does each managed bean get its own @EJB instance?

I am using JSF 2.2 for a web project and I am implementing the login page now. I have a login.xhtml that serves as the view, and a backing bean called UserLoginView. This bean has an EJB property ...
user avatar
  • 3,449
10votes
2answers
20kviews

Primefaces Press Enter executes commandButton

I am working with primefaces and I have the following problem, I have a toolbar with several buttons and components like inputtext and others in the form, but when I press the key Enter in some ...
user avatar
  • 285
10votes
1answer
17kviews

f:convertDateTime support for Java8 LocalDate / LocalDateTime? [duplicate]

The JSF Core Tag f:convertDateTime can format java.util.Date objects. The Date class has many deprecated methods and with Java 8 come new classes to present local dates and times: LocalDateTime and ...
user avatar
  • 6,446
10votes
1answer
10kviews

java.lang.UnsupportedOperationException: getRowData(String rowKey) must be implemented when basic rowKey algorithm is not used

I have upgraded PrimeFaces from 5.1 final to 5.2 final (the Community Release). I have a <p:dataTable> which is lazily loaded as follows (a minimal example to reproduce the problem for a pure ...
user avatar
  • 25.8k
10votes
3answers
3kviews

How to enter a JSF 2.2 flow with faces-redirect

I've got a basic flow example working: src/main/webapp | |- index.xhtml |- flow1 |- flow1-flow.xml |- flow1.xhtml index.xhtml has a simple form that enters the flow with a parameter: <h:...
user avatar
  • 415
9votes
3answers
24kviews

When downloading Mojarra libraries for JSF it is showing error "zip file is empty" in Eclipse

I'm working on JSF project, I'm trying to set up project facets in Eclipse, When I'm downloading Mojarra libraries for JSF2.2 it is giving error message. I'm using Eclipse Neon 2. See the below image ...
user avatar
9votes
1answer
9kviews

Illegal Syntax for Set Operation: How to tell JSF I don't "want" a setter

This question may be more of the type "conceptual" or "I don't understand JSF". My scenario: I have a JSF Page (index.xhtml) where I use a p:accordionPanel (but I don't think it matters what ...
user avatar
  • 2,205
9votes
1answer
12kviews

Exception handling in JSF ajax requests

How do I handle the exception and access the stack trace when an exception is thrown while processing a JSF ajax request? Right now, I only get the exception class name and message in a JavaScript ...
user avatar
  • 1,495
9votes
2answers
4kviews

Conditional rendering of f:param in JSF

I'm using an <h:outputLink> as follows. <c:set var="cid" value="1"/> <c:set var="sid" value="2"/> <h:outputLink value="Test.jsf"> <h:outputText value="Link"/> &...
user avatar
  • 25.8k
9votes
5answers
6kviews

javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL does not work anymore since Java EE 7 / EL 3.0

<context-param> <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name> <param-value>true</param-value> </context-param> Does ...
user avatar
  • 492
9votes
1answer
2kviews

Utility methods in application scoped bean

Do you think it is a good idea to put all widely used utility methods in an application scoped bean? In the current implementation of the application I'm working on, all utility methods (manipulating ...
user avatar
  • 113
9votes
1answer
14kviews

Spring Boot JSF Integration

Environment : Tomcat 8 Spring Boot 1.5 JSF 2.2 Apache MyFaces Spring MVC Code : I am integrating Spring Boot and JSF 2.2 in Servlet 3.0 environment. Config Classes : JSFConfig.java - ...
user avatar
  • 1,428
8votes
1answer
7kviews

How to get previous URL in JSF using FacesContext?

I need to get the redirected URL or id in JSF using FacesContext. For current URL, I'm using. String currentPage = FacesContext.getCurrentInstance().getViewRoot().getViewId();
user avatar
  • 89
8votes
2answers
9kviews

Getting ViewExpiredException in clustered environment while state saving method is set to client and user session is valid

I have a JSF application that uses Mojarra 2.2.9 and is deployed on WebSphere 8.5.5.4 on clustered environement and javax.faces.STATE_SAVING_METHOD is set to client. Even though all my application ...
user avatar
8votes
2answers
4kviews

Primefaces Fileupload on Wildfly

I am trying to save a profile image in a database. Page: <p:graphicImage id="profileImage" value="#{myProfile.usersProfileImage}" /> <p:fileUpload ...
user avatar
  • 1,172
8votes
1answer
4kviews

java.lang.IllegalStateException: java.lang.InstantiationException while implementing a custom tag handler in JSF

Given the following tag handler class. public final class ViewParamValidationFailed extends TagHandler implements ComponentSystemEventListener { private final String redirect; public ...
user avatar
  • 25.8k
8votes
4answers
3kviews

Bean validation doesn't work with mojarra 2.2.4

I'm trying to use Hibernate Validator 5.0.1 and JSF2.2 but their integration seems to be broken since mojarra version 2.2.3. I've created small app to demonstrate the issue and get exception "javax....
user avatar
8votes
1answer
663views

Mojarra 2.2 versions diverging

https://javaserverfaces.java.net/nonav/2.2/releasenotes.html lists two diverging version branches of JSF2.2 where, strangely, 2.2.8-xx seems to be more recent than 2.2.9 and above. Some bugs are ...
user avatar
  • 820
8votes
1answer
14kviews

Overwriting default Hibernate Validator messages

I want to overwrite the default Hibernate Validator messages in a server faces web app, so I read this part of the documentation: https://docs.jboss.org/hibernate/validator/5.0/reference/en-US/html/...
user avatar
  • 1,253
8votes
1answer
7kviews

JavaScript/jQuery event listeners do not work after JSF component is updated via Ajax

I'm executing the following jQuery function on <p:dataTable> filter (whose id is id) that allows users to enter only digits in the filter component. $(document).ready(function() { $("#form\\...
user avatar
  • 25.8k
8votes
3answers
18kviews

JSF 2.2 - fileupload does not work with Ajax. Form appears to have incorrect enctype (only via AJAX)

Trying to implement the JSF 2.2 example I have the following code: <h:form prependId="false" enctype="multipart/form-data"> <!-- Now it's the AJAX file upload component --> <h:...
user avatar
8votes
1answer
2kviews

includeViewParams=true converts null model value to empty string in query string

Given a <p:selectOneMenu> as follows. <f:metadata> <f:viewParam name="id" value="#{testManagedBean.id}" converter="javax.faces.Long"/> </f:metadata> <p:selectOneMenu ...
user avatar
  • 25.8k
8votes
1answer
4kviews

Invoking a JavaScript function from oncomplete handler of p:remoteCommand - simulating the same using some JavaScript code

Caution : Although this question covers long textual information with a mess of Java code snippets, it is merely targeted to JavaScript/jQuery and a bit of PrimeFaces stuff (just <p:remoteCommand&...
user avatar
  • 25.8k
7votes
1answer
4kviews

Tomcat 8 (and 9) coerce behaviour, null strings are incorrectly set as empty strings

I have just migrated to Tomcat 8. I used to work with system property org.apache.el.parser.COERCE_TO_ZERO=false so empty strings, numbers, booleans etc. are treated as null. In Tomcat 8, EL 3.0, it ...
user avatar
  • 1,164
7votes
2answers
5kviews

Performing a redirect, when conversion / validation associated with query parameters fails

The following is a simple use case of <f:viewAction>. <f:metadata> <f:viewParam name="id" value="#{testManagedBean.id}" maxlength="20"/> <f:viewAction action="#{...
user avatar
  • 25.8k
7votes
6answers
14kviews

JSF 2.2 interpret empty string submitted values as null not working

I have migrated from Java EE 6 to Java EE 7, and now with JSF 2.2 the context param INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL seems not work. In JSF 2.1 I set it to "true" and it works perfectly,...
user avatar
  • 161
7votes
1answer
1kviews

What are jftfdi jffi doing to my query string?

We are using JavaServer Faces 2.2 (Mojarra 2.2.1) in our project. I noticed something odd. On a page called reporting.xhtml where I use f:metadata with the new f:viewAction my browser, Safari in this ...
user avatar
  • 3,052
7votes
1answer
3kviews

How can I create a clean tag library (.jar) containing custom tags and composite components in JSF 2.2?

I've read the various blog posts and stackoverflow posts on how to create a composite components and custom tags within a web app and have gotten things to work just fine. I'm now trying to move ...
user avatar
  • 982
7votes
1answer
4kviews

The metadata component needs to be nested within a f:metadata tag. Suggestion: enclose the necessary components within <f:metadata>

I went through different sources like: Error saying I need to use f:metadata even though I do http://docs.oracle.com/javaee/7/javaserverfaces/2.2/vdldocs/facelets/f/metadata.html and it seems to be ...
user avatar
  • 1,685
7votes
1answer
613views

How behaves f:view with many defined resource library contracts?

We're trying to use the <f:view contracts="xxx" /> feature from JSF 2.2, with many simultaneous contracts, as "contract1,contract2". In our contract1, we have a file style1.css, and in our ...
user avatar
7votes
2answers
2kviews

BLOB images are displayed only on refreshing a page after an update via p:dataTable is made in PrimeFaces

I'm displaying images stored in the form of BLOB in MySQL on a <p:graphicImage> as follows. <p:dataTable var="row" value="#{testManagedBean}" lazy="true" editable="true" rows="10"> &...
user avatar
  • 25.8k

15 30 50 per page
1
2 3 4 5
46