jsf-2

How to let validation depend on the pressed button?

試著忘記壹切 提交于 2019-12-16 22:09:35
问题 I have created form and I want to show previous existing items on a table while a new one is creating. I'd like to show matching items as form is filling up. But when I try to filter the list without having the form completed, the validation messages appear and the table doesn't get updated. Don't know if it's possible, but what I want to do something like this: <h:form id="form"> <h:outputText value="Name: "/> <p:inputText value="#{itemsBean.name}" id="name" required="true"/> <br/> <h

JSF request scoped bean keeps recreating new Stateful session beans on every request?

断了今生、忘了曾经 提交于 2019-12-16 20:13:58
问题 I'm building my first Java EE application using JSF, PrimeFaces, Glassfish and Netbeans. Because I'm new, it's possible I'm approaching the core problem wrong. Core problem: I want to maintain user's information securely. There seems to be conflicting ideas on whether it should be maintained in a JSF session bean or a stateful session EJB. I'm trying to use a stateful session EJB because it is more secure that way. The problem is that my application seems to be creating multiple instances of

JSF request scoped bean keeps recreating new Stateful session beans on every request?

跟風遠走 提交于 2019-12-16 20:13:27
问题 I'm building my first Java EE application using JSF, PrimeFaces, Glassfish and Netbeans. Because I'm new, it's possible I'm approaching the core problem wrong. Core problem: I want to maintain user's information securely. There seems to be conflicting ideas on whether it should be maintained in a JSF session bean or a stateful session EJB. I'm trying to use a stateful session EJB because it is more secure that way. The problem is that my application seems to be creating multiple instances of

How to make a grid of JSF composite component?

懵懂的女人 提交于 2019-12-16 20:06:12
问题 I have lot's of outputLabel and inputText pairs in panelGrids <h:panelGrid columns="2"> <h:outputLabel value="label1" for="inputId1"/> <h:inputText id="inputId1/> <h:outputLabel value="label2" for="inputId2"/> <h:inputText id="inputId2/> ... </h:panelGrid> I want to have some behaviour for all of them: like same validation or same size for every inputText. So I have created a composite component which just includes an outputLabel and and an inputText <my:editField value="field1"/> <my

JSF returns blank/unparsed page with plain/raw XHTML/XML/EL source instead of rendered HTML output

一曲冷凌霜 提交于 2019-12-16 18:15:35
问题 I have some Facelets files like below. WebContent |-- index.xhtml |-- register.xhtml |-- templates | |--userForm.xhtml | `--banner.xhtml : Both pages are using templates from /templates directory. My /index.xhtml opens fine in browser. I get the generated HTML output. I have a link in /index.xhtml file to /register.xhtml file. However, my /register.xhtml is not getting parsed and returns as plain XHTML / raw XML instead of its generated HTML output. All EL expressions in form of #{...} are

Filter for User Session Check in JSF 2.0 [duplicate]

吃可爱长大的小学妹 提交于 2019-12-14 04:12:39
问题 This question already has answers here : How implement a login filter in JSF? (2 answers) Closed 2 years ago . this is how i solved my problem. :) my pages which i want to protect are located inside cPanel folder. this is my LoginAdmin bean. @ManagedBean(name = "loginAdmin") @SessionScoped public class LoginAdmin implements Serializable { private static final long serialVersionUID = 1L; private String username; private String password; boolean loggedIn; public boolean isLoggedIn() { return

primefaces component such as the tags input of stackoverflow [closed]

孤人 提交于 2019-12-14 04:12:28
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I searched in the showcase of primefaces there a few days and I found one component such as the input of tags of this site (stackoverflow ;) ) but when I searched now I don't find it do you know the component if

jsf 2 passing of value to dialog not working

那年仲夏 提交于 2019-12-14 04:06:16
问题 I want to pass a value to a dialog but it wont work. I have tried this approach but no luck Here is my page: <!DOCTYPE html > <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"> <h:head> <title></title> </h:head> <h:body> <h:form> <p:inputText value="#{myManagedBean.input}"/> <p:commandButton value="edit" onclick="dlg.show()"/> <p:dialog widgetVar="dlg" modal="true"> passed value:<p:inputText value="#{myManagedBean.input}"/> <

<ui:repeat> in JSF 2.0 breaks methods execution order

拈花ヽ惹草 提交于 2019-12-14 04:04:06
问题 I have very simple JSF 2.0 application (see below). The problem is that when ui:repeat is present, execution order (I check it using breakpoints in debugger) is strange. After I submit form, SecondBean.initSomething() is called before FirstBean.setFirstFormField() . If I change type of something to String and delete ui:repeat from index.jsf and use just h:outputText then everything works as expected, FirstBean.setFirstFormField() is called before SecondBean.initSomething() . What I'm doing

Restrict inputText value to alphabetic characters only

拥有回忆 提交于 2019-12-14 03:47:35
问题 I need to allow only alphabetic characters [A-Z,a-z] in a PrimeFaces inputText field. How can I do this? 回答1: Not specific to Primefaces but to underlying JSF: You can use a regex validator on your input field: <h:inputText value="#{myBean.myText}" > <f:validateRegex pattern="[a-zA-Z]+"/> </h:inputText> This will work with p:inputText as well. Adapt the regular expression to your functional requirements. 回答2: If you need to avoid characters in the view (input text) you can user p:keyFilter