jsf-2.2

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

…衆ロ難τιáo~ 提交于 2019-11-27 01:56:51
问题 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-CSRF-Demo/JSF2.2CsrfDemo.html we should add the following element to the faces-config.xml file with the list of JSF pages. <protected-views> <url-pattern>/csrf_protected_page.xhtml</url-pattern> </protected-views> Should <protected-views> be used for JSF 2.2 CSRF protection? 回答1: I am confused. I

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

别等时光非礼了梦想. 提交于 2019-11-26 23:23:12
问题 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 is supposed to be the default but it is in fact converting null string to empty string "" on JSF side. It is supposed to be a bug and it is supposed to be corrected but I'm not able to get it working in TomEE snapshot (Tomcat 8.0.27.0, MyFaces 2.2.8). 回答1: This is a bug in the EL 3.0 specification

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

让人想犯罪 __ 提交于 2019-11-26 23:01:37
问题 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 the data in our ViewScoped Beans is quite high (sometimes more than 1MB). Anyway - when navigation from view to view, the session memory size grows and grows. We can't decrease the size of the beans on short-term, so this behavior has quite some impact. Solution 1 - Changing Context Params (not working) Now - we played

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

醉酒当歌 提交于 2019-11-26 22:33:00
I'm populating a <p:selectOneMenu/> from database as follows. <p:selectOneMenu id="cmbCountry" value="#{bean.country}" required="true" converter="#{countryConverter}"> <f:selectItem itemLabel="Select" itemValue="#{null}"/> <f:selectItems var="country" value="#{bean.countries}" itemLabel="#{country.countryName}" itemValue="#{country}"/> <p:ajax update="anotherMenu" listener=/> </p:selectOneMenu> <p:message for="cmbCountry"/> The default selected option, when this page is loaded is, <f:selectItem itemLabel="Select" itemValue="#{null}"/> The converter: @ManagedBean @ApplicationScoped public final

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

馋奶兔 提交于 2019-11-26 22:02:57
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 file goes to "domain1\generated\jsp\FileUpload". Thank you My form <h:form id="form" enctype="multipart/form-data"> <h:messages/> <h:panelGrid columns="2"> <h:outputText value="File:"/> <h:inputFile id="file" value="#{uploadPage.uploadedFile}"/> </h:panelGrid> <br/><br/> <h:commandButton value="Upload File" action="#{uploadPage.uploadFile}"/> </h:form> My bean @Named @ViewScoped public class

Why are expired @ViewScoped beans not destroyed until the session expires

故事扮演 提交于 2019-11-26 21:50:40
问题 I'm using Mojarra 2.2.4 on GlassFish 4 with Java 7. As I understand from BalusC's answer to How and when is a @ViewScoped bean destroyed in JSF?, @ViewScoped beans should be destroyed in three cases: Post-back with non-null outcome Session expiration Maximum number of logical views in session exceeded My beans are being destroyed in the first two cases, but not when the maximum number of logical views is exceeded. I have verified that the beans do expire when the maximum is exceeded (I get a

Which XML namespace to use with JSF 2.2 and up

醉酒当歌 提交于 2019-11-26 19:05:40
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 namespaces on xmlns.jcp.org domain like xmlns:f="http://xmlns.jcp.org/jsf/core" . Which one is recommended and why was this changed? BalusC Which one is recommended? Go ahead with XML namespaces on xmlns.jcp.org domain. This was newly introduced since Java EE 7 in 2013 (which covers a.o. JSF 2.2, Servlet 3.1, CDI 1.1, etc). Do note that this not only affects Facelets files, but also XML configuration

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

放肆的年华 提交于 2019-11-26 17:54:27
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 bean private UserService userService (as shown here ). Does this mean that each new UserLoginView gets a new instance of UserService ? Is OK to implement it like this in a production environment? BalusC Does this mean that each new UserLoginView gets a new instance of UserService? Nope. The given UserService is a @Stateless EJB. @Stateless EJBs are pooled and injected as serializable proxies

Spring Boot JSF Integration

孤街浪徒 提交于 2019-11-26 17:49:23
问题 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 - Config for JSF. @Configuration @ComponentScan({"com.atul.jsf"}) public class JSFConfig { @Bean public ServletRegistrationBean servletRegistrationBean() { FacesServlet servlet = new FacesServlet(); return new ServletRegistrationBean(servlet, "*.jsf"); } } Spring Boot Main Class : @SpringBootApplication @Import({ /

f:viewParam doesn't pass required parameter when new xmlns.jcp.org namespace is used

时光怂恿深爱的人放手 提交于 2019-11-26 17:17:34
问题 I am trying to use Glassfish 4.0 with Java EE 7 XML namespaces to test the sample below. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"> <h:head> <title>Title</title> </h:head> <h:body> <h:form> <ul> <ui:repeat value="#{appLoad.movieList}" var="movie"> <li> <h:link value="#{movie.title}" outcome="movie" includeViewParams="true"> <f:param name="id" value="#{movie.id}"/> </h