Try adding the layout="inline" attribute to your outputPanel.

<a4j:outputPanel ajaxRendered="true" layout="inline">


Jurgen

Op wo, 04-10-2006 te 11:53 +0300, schreef Jana Parvanova:
> Hello!
> 
> I am trying to use ajax4jsf and MyFaces. So far everything looks great 
> except for the messages that I cannot show.
> 
> Here is my jsp:
> 
>                         <h:inputText id="newEmail" 
> value="#{mbUserBean.newEmail}" styleClass="requiredInput" required="true" 
> size="40"/>
>                         <a4j:commandLink reRender="content" value="Add user" 
> actionListener="#{mbUserBean.addUser}" styleClass="commonLink"/>
> 
>                         <a4j:outputPanel ajaxRendered="true">
>                             <h:message for="newEmail" 
> errorClass="errorText"/>
>                             <h:messages />
>                         </a4j:outputPanel>
> 
> (According to "The AJAX framework should not append or delete, but only 
> replaces elements on the page. For successful updates, an element with the 
> same ID as in the response must exist in the page. If you want append any 
> code to a page, put in a placeholder for it (any empty element). For the 
> same reason, we recommend placing messages in the AjaxOutput component 
> (since no messages is also a message)." in 
> https://ajax4jsf.dev.java.net/nonav/documentation/ajax-documentation/developerGuide.html)
> 
> In the UserBean:
> 
>     public void addUser(ActionEvent evt) {
> 
>         try {
>             UserService.createUser(getNewEmail());
>             newEmail = "";
>         } catch (DuplicateEmailException ex) {
>             FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, 
> "User already exists with this email", "");
>             FacesContext.getCurrentInstance().addMessage("form:newEmail", 
> msg);
>         }
>         return;
>     }
> 
> 
> And here is what happens:
> - When field is empty (that is required="true" fails) both messages appear 
> fine.
> - When value is not unique (we go into "catch (DuplicateEmailException ex)") 
> the field message is not shown. The <h:messages /> shows my message.
> 
> I know ajax4jsf has problems rendering components that are not initially 
> present. But then - I tried to use the suggested in the Developep's Guide 
> approach (with outputPanel) and it does not work for me.
> Has anyone had similar experience? Any help will be appreciated.
> 
> Thanks,
> 
> Jana
> 
> 
-- 
____________________________________________________
Jurgen Lust
email: [EMAIL PROTECTED]
blog: http://jroller.com/page/jurgenlust
____________________________________________________

Reply via email to