jsf-2

Multiple action listeners with a single command component in JSF

旧巷老猫 提交于 2019-12-18 16:48:20
问题 Is it possible to invoke more than one listener method using a single command component? For example, A view scoped bean: @ManagedBean @ViewScoped public final class ViewScopedBean implements Serializable { @ManagedProperty(value = "#{sessionScopedBean}") private SessionScopedBean sessionScopedBean; //Getter/Setter. private static final long serialVersionUID = 1L; public ViewScopedBean() {} public void action() { //Do something. sessionScopedBean.action(); } } A session scoped bean:

Shouldn't the validation be skipped when there is no value specified?

喜欢而已 提交于 2019-12-18 16:47:12
问题 I'm using JSF2 on GlassFish 3. I have a form that accepts and optional phone number. I have this custom phone number validator (below), and I have the field set to required="false" because the phone number is optional in the form. The problem is, the value in the field is always getting validated. Shouldn't the validation be skipped when there is no value specified? There must be something I'm doing wrong. Any help is appreciated, thanks! <h:outputText value="#{msg.profile_otherPhone1Label}#

Using JPA2 in Tomcat 6: @PersitenceContext doesn't work, EntityManager is null

送分小仙女□ 提交于 2019-12-18 16:35:53
问题 I am using JSF2 with Pure JPA2. But the problem is with entityManager, @PersistenceContext private EntityManager entityManager; Here entityManager is not getting injected and always null. Can some one please help me what is wrong in my code. Here is my configuration. User.java @Entity @Table(name="USER") public class User { private int id; private String name; private String surname; @Id @SequenceGenerator(name="user_id_seq_gen", sequenceName="USER_ID_GEN_SEQ", allocationSize=1)

User login with JSF 2.0 [duplicate]

假装没事ソ 提交于 2019-12-18 13:38:32
问题 This question already has answers here : Performing user authentication in Java EE / JSF using j_security_check (4 answers) Closed 3 years ago . I am trying - with JSF 2.0 - to implement in a neat way the login/remember me/logout management. Since the traditional <form action="j_security_check" ... way lacks of flexibility I decided to follow a different path, but I found a problem. Declarative security is properly set both in the application server through <security-domain> and in web.xml

How do I get a tabbed pane component in JSF 2.0 (Sun Mojarra)

浪尽此生 提交于 2019-12-18 13:36:56
问题 I am learning/using JSF 2.0 (Sun Mojarra) now and I want to have a tabbed pane in my webapp (single tabs could named be General, Detail1,Detail2,...). How do I achieve this? I haven't found any documetation for this so far :( 回答1: Others have already hinted it: Mojarra is a basic JSF implementation. It offers the minimum set of mandatory components to cover the most of existing HTML elements (forms, input fields and tables). Since HTML does not offer a tabbed panel in a single element, the

Find component by type in JSF

元气小坏坏 提交于 2019-12-18 13:30:34
问题 My question is related to this one Get all hidden input fields in JSF dynamically but it's not the same as I want to work with JSF and not plain HTML, and assuming that I have the following in my .xhtml file: <h:inputHidden id="name1" value="SomeValue1"/> <h:inputHidden id="name2" value="SomeValue2"/> I developed a small code where I tried to get all the h:inputHidden tags dynamically and print their values to the console, but the problem is that I can't figure out a way how to make

Call another form from the command button

ぃ、小莉子 提交于 2019-12-18 13:27:42
问题 When I submit a form it should call another form so that I can render it. I use primefaces and I want it to work something like below. But it is throwing an error. xhtml <h:form id="from1"> <h:inputText=...... <h:outputText=.... <p:commandButton id="submit" actionlistener="#{bean.method}" value="submit" process="form2"/> <h:form id="form2"> <h:outoutText value="it is working" render="#{bean.boolean}" /> </h:form> error [Faces Servlet]] (http--127.0.0.1-8080-2) Servlet.service() for servlet

PreRenderView incrementally called on every postback

我与影子孤独终老i 提交于 2019-12-18 13:26:50
问题 I have an issue with the order and number of executions of an f:event type="preRenderView" . During my search here I found as usual answers from BalusC in this and this post related to my problem - still it leaves two questions for me: When I put one f:event type="preRenderView" in the template file (for managing common tasks like checks about the user state which applies for all my views) and another f:event type="preRenderView" in each view (for handling view specific initializations), I

@ViewScoped Managed bean loads many times during postback

血红的双手。 提交于 2019-12-18 13:26:14
问题 I have a calendar, editor, fileUpload and a dataTable primefaces controls on a jsf facelet. Code is as follows, <?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:ui="http://java.sun.com/jsf/facelets" template="./../templates/masterlayout.xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:f="http://java.sun.com

/index.xhtml Not Found in ExternalContext as a Resource

主宰稳场 提交于 2019-12-18 13:14:37
问题 My JSF web application shows the following error: /index.xhtml Not Found in ExternalContext as a Resource. My directory structure is: - Java Resource -- src --- br.com.k19.controle ---- NumeroAleatorioBean.java --- resources - JavaScript Resources - build - WebContent -- META-INF -- Web Pages --- index.xhtml --- formulario.xhtml -- Web-Inf Where do I need to put my /index.xhtml in this structure? 回答1: The WebContent folder represents the web content. You placed the index.xhtml file inside Web