-
15. Re: <a4j:commandButton> and <h:messages/>
krasig Jul 31, 2007 6:23 PM (in response to krasig)The environment is:
SUN JSF 1.2 Facelets Ajax4jsf 1.1.1 Richfaces 3.0.1
-
16. Re: <a4j:commandButton> and <h:messages/>
sergeysmirnov Jul 31, 2007 6:25 PM (in response to krasig)what if you replace a4j:commandButton with h:commandButton ?
-
17. Re: <a4j:commandButton> and <h:messages/>
krasig Jul 31, 2007 6:27 PM (in response to krasig)In this case - everything is OK.
But this is not decision. -
18. Re: <a4j:commandButton> and <h:messages/>
sergeysmirnov Jul 31, 2007 6:32 PM (in response to krasig)I am out of ideas. create the test application, zip it and attach to the the post in Jira.
-
19. Re: <a4j:commandButton> and <h:messages/>
krasig Jul 31, 2007 6:34 PM (in response to krasig)I can't believe.
-
20. Re: <a4j:commandButton> and <h:messages/>
sergeysmirnov Jul 31, 2007 6:40 PM (in response to krasig)Something is missing to see the whole picture. Only 100% of the code can say what is missing.
-
21. Re: <a4j:commandButton> and <h:messages/>
ishabalov Jul 31, 2007 7:08 PM (in response to krasig)Did you try to debug application? It may be possible to look ether you actually have a message in messages list.
-
22. Re: <a4j:commandButton> and <h:messages/>
krasig Aug 1, 2007 1:51 AM (in response to krasig)This is 100% of The Code
PAGE:<?xml version="1.0" encoding="WINDOWS-1251"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.ajax4jsf.org/rich" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="https://ajax4jsf.dev.java.net/ajax" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:ft="http://sourceforge.net/projects/facestrace"> <head> <title></title> </head> <body> <ui:debug hotkey="q" /> <f:view> <a4j:outputPanel id="myMessageanel" ajaxRendered="true"> <h:messages /> </a4j:outputPanel> <a4j:region id="a123"> <h:form> <h:inputText value="#{delme.id}"></h:inputText> <a4j:commandButton action="#{delme.searchByID}" value="221" reRender="a123"></a4j:commandButton> </h:form> </a4j:region> </f:view> </body> </html>
This is BEAN:/** * */ package com.indexbg.dc.backing; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import org.apache.log4j.Logger; import com.indexbg.dc.exceptions.ObjectNotFoundException; /** * @author krasi * */ public class Delme extends BaseBean { String id = ""; static final Logger LOGGER = Logger.getLogger(Delme.class); public Delme() { } public String getId() { FacesContext.getCurrentInstance().addMessage( null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "??????? ? ????????? ?????????1111.", "")); LOGGER.debug("GET 1 ------" + id); if (!id.equals("")) { LOGGER.debug("GET 2 ------" + id); FacesContext.getCurrentInstance().addMessage( null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "???? ??????? ????????2222.", "11")); try { LOGGER.debug("GET 3 ------" + id); throw new ObjectNotFoundException(); } catch (ObjectNotFoundException e) { LOGGER.debug("GET 4 ------" + id); FacesContext.getCurrentInstance().addMessage( null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "???? ??????? ????????.", "11")); } } return id; } public void setId(String id) { LOGGER.debug("SET 1-" + id); this.id = id; } public String searchByID() { LOGGER.debug("searchByID"); return null; } }
So. This is 1 simple page with 1 inputTex and 1 commandButon.
And when type some value in inputText and then press command button,
in the <h:message/> mus be 3 messages "RED,ORANGE and BLUE.
But strange is that i see only RED
P.S. Yes. I will post application in jira. but this not decision for me. I know that this will be corrected after 5-6-10 months when my project will be finished -
23. Re: <a4j:commandButton> and <h:messages/>
ilya_shaikovsky Aug 1, 2007 4:39 AM (in response to krasig)You wrong using such code in getter.
Getter called first time at the process Validations phase for taking PREVIOUS value (to generate valueChangeEvent). So id.equals("") is true and your message will NOT be added to messages list.
Places this code in your method and it will work as you expect I think. -
24. Re: <a4j:commandButton> and <h:messages/>
krasig Aug 1, 2007 4:58 AM (in response to krasig)Ok
This is debug with <a4j:commandbutton> and NO messages007-8-1 0:57:18 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE RESTORE_VIEW 1 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER RESTORE_VIEW 1 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE APPLY_REQUEST_VALUES 2 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER APPLY_REQUEST_VALUES 2 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE PROCESS_VALIDATIONS 3 DEBUG - GET 1 ------ (Delme.java:getId:35) 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER PROCESS_VALIDATIONS 3 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE UPDATE_MODEL_VALUES 4 DEBUG - SET 1-1 (Delme.java:setId:61) 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER UPDATE_MODEL_VALUES 4 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE INVOKE_APPLICATION 5 searchByID 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER INVOKE_APPLICATION 5 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE RENDER_RESPONSE 6 DEBUG - GET 1 ------1 (Delme.java:getId:35) DEBUG - GET 2 ------1 (Delme.java:getId:37) DEBUG - GET 3 ------1 (Delme.java:getId:44) DEBUG - GET 4 ------1 (Delme.java:getId:48) 2007-8-1 0:57:18 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER RENDER_RESPONSE 6
This is debug with <h:commandbutton> and messages - YES2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE RESTORE_VIEW 1 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER RESTORE_VIEW 1 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE APPLY_REQUEST_VALUES 2 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER APPLY_REQUEST_VALUES 2 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE PROCESS_VALIDATIONS 3 DEBUG - GET 1 ------ (Delme.java:getId:30) 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER PROCESS_VALIDATIONS 3 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE UPDATE_MODEL_VALUES 4 DEBUG - SET 1-1 (Delme.java:setId:56) 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER UPDATE_MODEL_VALUES 4 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE INVOKE_APPLICATION 5 DEBUG - searchByID (Delme.java:searchByID:61) 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER INVOKE_APPLICATION 5 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker beforePhase INFO: BEFORE RENDER_RESPONSE 6 DEBUG - GET 1 ------1 (Delme.java:getId:30) DEBUG - GET 2 ------1 (Delme.java:getId:32) DEBUG - GET 3 ------1 (Delme.java:getId:39) DEBUG - GET 4 ------1 (Delme.java:getId:43) DEBUG - GET 1 ------1 (Delme.java:getId:30) DEBUG - GET 2 ------1 (Delme.java:getId:32) DEBUG - GET 3 ------1 (Delme.java:getId:39) DEBUG - GET 4 ------1 (Delme.java:getId:43) 2007-8-1 11:55:27 org.exadel.jsf.PhaseTracker afterPhase INFO: AFTER RENDER_RESPONSE 6
Will explin me that? -
25. Re: <a4j:commandButton> and <h:messages/>
krasig Aug 1, 2007 5:13 AM (in response to krasig)Test application:
http://jira.jboss.org/jira/browse/AJSF-112 -
26. Re: <a4j:commandButton> and <h:messages/>
sergeysmirnov Aug 1, 2007 4:08 PM (in response to krasig)The h:messages is located above the input field. Try to put it somewhere below it.
-
27. Re: <a4j:commandButton> and <h:messages/>
krasig Aug 1, 2007 4:17 PM (in response to krasig)No effect
-
28. Re: <a4j:commandButton> and <h:messages/>
sergeysmirnov Aug 1, 2007 5:08 PM (in response to krasig)Ok. It will never work until you start do things in right way. Take the code out of the getter.
-
29. Re: <a4j:commandButton> and <h:messages/>
krasig Aug 1, 2007 5:12 PM (in response to krasig)In JIRA my last comment is:
Ok. Thanks for taking the time to explain.
But can you explain why when using <h:commandbutton> everything is OK???
Sorry for my poor English!!