JSF AlertBox

So once again i m working on a frontend… my main goal was not to work on frontends again… not that i dont want to do these kind of work, but creating customer facing stuff is demanding (which is a good thing) and a pain, because of the Business… a good idea is death, when the Business thinks they have a good idea aswell… so frontend pixel moving is really not my enjoyable work… but as i said… im doing it again… 

this time with JSF (JavaServer Faces)… in general, i like JSF ans its concepts… but there are still some really confusing things, including communication frontend to backend. But this might be a ajax problem… 

and now to the topic related stuff. I needed to implement an AlertBox. We use PrimeFaces, therefore i tried to do it as a dialog. But dialogs cant be updated, so its inside an outputPanel… 

xhtml

<p:outputPanel id=”alertBoxPanel”>
  <p:dialog header=”#{alertBoxBean.header}” widgetVar=”alertBoxDialog” visible=”#{alertBoxBean.show}”>
    <h:form>
      <table cellpadding=”0″ cellspacing=”0″ border=”0″>
      <tr>
        <td align=”center”><h:outputText value=”#{alertBoxBean.text}” escape=”false” /></td>
       </tr>
      <tr>
        <td align=”center”><p:commandButton value=”Ok” oncomplete=”alertBoxDialog.hide();” actionListener=”#{alertBoxBean.handleClose}” /></td>
     </tr>
    </table>
  </h:form>
</p:dialog>
</p:outputPanel>

java

Mainly there is the bean and its handles.

Comments are closed.