Board index JavaServer Faces General p:commandButton only works after refresh

p:commandButton only works after refresh

Components, Ajax Framework, Utilities and More.

Posts: 44
Hello everybody,

I have the following commandButton which is presenting a wierd behavior. It only works after I completely refresh the page. This issue happens in any browser, and it happens ONLY in the first time I acess the page. I mean, after the refresh, I can even restart GlassFish v3, and the problem won't happen.

Does anyone one know what is happening here?

I am using JSF 2.0 and PrimeFaces 2.1 and the NewsletterBean is @ViewScoped

By the way... any p:commandButton in my application presents this behavior. I wonder if I am missunderstanding how pirmeFaces works.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""

   <link rel="SHORTCUT ICON" href="favicon.ico"/>
   <link type="text/css" rel="stylesheet" href="theme/start/skin.css" />
   <link href="style/template_style.css" type="text/css" rel="stylesheet" />
   <ui:insert name="load_style" />
   <!-- ANALYTICS -->
   <script type="text/javascript">
     <!-- google analytics code -->


   <div id="top_global">
      <div id="top">
         <ui:include src="/includes/top.xhtml" />
   <div id="menu">
      <p:panel id="newsletter_form_panel">
         <p:outputPanel id="output_nl">
         <h:form id="newsletter_form" prependId="false">
            <p:growl id="grow1" showDetail="true" />
            <h:panelGrid columns="4" style="float:left;">
               <h:outputLabel for="nl_mail" value="E-mail:" styleClass="email_label" />
               <h:inputText id="nl_mail" value="#{}" required="true" requiredMessage="Informe seu e-mail!"
                   validator="emailValidator" />
               <h:selectOneMenu value="#{sessionsBean.currentCity}" converter="cityEntityConverter">
                  <f:selectItems value="#{newsLetterBean.allCities}"/>
               <p:commandButton id="save_nl_button2" actionListener="#{newsLetterBean.createNewsLetter}" value="Cadastrar E-mail!" update="output_nl" />
            <span style="float:right; width:300px;">Cadastre-se agora para ficar por dentro das novidades!</span>
            <p:ajaxStatus style="float:right; margin:7px 40px 0 0;"> 
                <f:facet name="start">
                       <h:graphicImage value="/images/ajax-loader.gif" /> 
                  <div id="widget"></div>
                <f:facet name="complete"> 
                    <h:outputText value="" /> 
         <br style="clear: both;" />
   <div id="content">
      <ui:insert name="content" />
   <div id="footer_global">
      <div id="footer">
         <ui:include src="/includes/footer.xhtml" />

NetBeans 7.3, Glassfish 3.1.2, Java EE 7, PrimeFaces 3.5 , Mojarra 2.1.17

Return to General