jsf-2

jsf 2 Session bean created for every request [duplicate]

孤街醉人 提交于 2019-12-21 21:43:34
问题 This question already has an answer here : @SessionScoped bean looses scope and gets recreated all the time, fields become null (1 answer) Closed 3 years ago . ello I have 2 Managed beans, one View scoped, the other Session scoped. The View scoped bean is defined as @ManagedBean @ViewScoped public class InvoiceController implements Serializable { private static final long serialVersionUID = 1L; @ManagedProperty(value="#{invoiceService}") private InvoiceService invoiceService; The session

JSF 2.0 view file name extension other than xhtml

只愿长相守 提交于 2019-12-21 20:57:49
问题 How can I use view files with a different extension, other than XHTML, still map to the Faces Servlet in a JSF 2.0 application ? I am migrating a JSF 1.2 app to 2.0, and I use file name extensions jspx. I dont want to change them to xhtml. Thanks in advance for any help. Here is my web.xml as of now <?xml version="1.0" encoding="UTF-8"?> <web-app id="JSF2Sample" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=

JSF 2 reusing the validation defined in the JPA entities?

若如初见. 提交于 2019-12-21 20:57:40
问题 Let's start with an example : In my JPA entity public class User { @Pattern("^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$", message="invalidEmailResourceBundleKey") private String email; @Min(5, message="minimumResourceBundleKey") private int age; ... } In my JSF Bean public class UserBean { private User user; // do i have to redefine it here, since it's already a part of the user ? @@Pattern("^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA

Using one component (dataTable) id inside composite component

筅森魡賤 提交于 2019-12-21 20:47:44
问题 How can I use id of DataTable Component (Primefaces 2.2.1) inside Composite Component in Java Server Faces 2.1 ? Now, I have a view: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http:/

Deploy JSF composite components for shared use

时光总嘲笑我的痴心妄想 提交于 2019-12-21 20:37:35
问题 I work on a Java EE project which is planned to become quite large in future and I want to share as much code as possible. This included not only Java code, but also code for UI elements. I think about developing enterprise components based on clear defined subjects (like user administration, taxes, products) which interact on basis of messages, beans and so on. I also think about giving all these components some managed beans and JSF composites to provide some basic functionality for later

Can you POST to JSF2 page with an expired session?

谁都会走 提交于 2019-12-21 20:36:34
问题 I have been using JSF1.2 for login pages. If the user sits on the login page for too long (timeout situatation) and then tries to enter the id and password it fails with ViewExpired error (even though the id/password are correct). This all makes sense from JSF perspective to me. My solution has been to simply use Client for javax.faces.STATE_SAVING_METHOD. But that feels like a hack. My app is migrating to JSF2.0. I would like my app to go back to server for STATE_SAVING_METHOD. But my

Handling ViewExpiredException depending on the current view

我与影子孤独终老i 提交于 2019-12-21 20:32:56
问题 I am using JSF 2.0 and Primefaces in my project. I have two xhtml pages namely Cars.xhtml and Bikes.xhtml. I am using ViewScoped backing beans. Currently If get view expired exception from any of the two pages,im handling it in the web.xml. through the error-page tag and directing to welcome.xhtml. Now If i get a viewexpired exception from Bikes.xhtml I need to direct to another page which is BikesHome.xhtml instead of welcome.xhtml. If the exception is from Cars.xhtml, welcome.xhtml should

rowEdit filtered rows on dataTable Primefaces

江枫思渺然 提交于 2019-12-21 20:29:30
问题 I'm using primefaces dataTable and rowEdit event to change and save the values in my dataTable. When I edit a row value that isn't filtered, it works well, but when i filter the values and try to edit, the wrong id is edited. For example: I have a list with 5 records, ranging with ids from 1 to 5. I filter the list to show the record where the id = 5, so it shows only one row. When I try to edit this record, my bean gets the values correctly, but the id of the object instead of being 5, its 1

Applying PrimeFaces theme only for one JSF page

北战南征 提交于 2019-12-21 20:24:39
问题 We should apply primefaces theme for a jsf page <context-param> <param-name>primefaces.THEME</param-name> <param-value>bluesky</param-value> </context-param> I want to apply for one page this primefaces theme.How to do this? 回答1: If you add it as a context-param, it will be used for all pages. This is what you need to do: 1 - Get the jar of the bluesky theme and extract it to a folder. We'll use these files later. 2 - In the 'resources' folder create a subfolder called "primefaces-bluesky". 3

How to display notification with welcome message when logged in?

心不动则不痛 提交于 2019-12-21 20:23:24
问题 I want to use a primefaces tool called Notification bar to display a message that says welcome, when the user logs in. The problem is that i don't know how to trigger it, only if the login is successful(if wrong password should not be displayed) and also to be displayed even if i am redirected to another page. This is how my loggin page looks like: <ui:composition template="WEB-INF/templates/BasicTemplate.xhtml"> <!-- THE REGISTRATION FORM --> <ui:define name="loginForm"> <h2>Login page</h2>