Tuesday 15 July 2014

jsf - Error message doesn't display -


I have an XHTML page, as is the code below

  & lt; Table width = "100%" cellpadding = "2" & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; H: form & gt; & Lt; H: command button action = "# {TypeController.addType}" value = "# {msgs.add}" /> & Lt; / H: form & gt; & Lt; / TD & gt; & Lt; Td width = "25%" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; H: form id = "main table" & gt; & Lt; H: message = "main_content" errorClass = "errorClass" /> for & Lt; P: dataTable id = "dt1" width = "100%" value = "# {dataTypeListBean.dataTypeBackingBeans}" var = "item" border = "2" cellpadding = "2" style = "table_style" & gt; & Lt; P: column & gt;   

....................

  & lt; P style = "float: true;" & gt; & Lt; H: Command link action = "# {dictionary dictionary password controller.}}" Onclick = "Confirm return ('# {msgs.remove_confirm}');" & Gt; & Lt; F: setPropertyActionListener target = "# {DictionaryTypeController.selectedType}" value = "# {item}" /> & Lt; H: graphic image title = "# {messagess.delete}" alt = "# {messagess.delete}" url = "/ primefaces_resource / images / delete.png" /> & Lt; / H: commandLink & gt; & Lt; / P & gt; & Lt; / Div & gt;   

.....................

And I need to catch some error and show the message On the page, I have written a code

  deleting the public string (try {actionFilter.delete (ReferenceDataType.class, selectedType.getTypeId ()); } Hold (EJB Transaction Rollback Expression E) {FacesContext.getCurrentInstance (). AddMessage ("createForm: main_content", new FacesMessage (FacesMessage.SEVERITY_ERROR, "Error", blank)); Return tap; } Return list; }   

Error catched, but do not show a message to the page Please help us.

We do this in our project:

JSF:

  & lt; T: message id = "messageId" showDetail = "true" showSummary = "false" layout = "list" style class = "error message" />   

java:

  FacesContext reference = FacesContext.getCurrentInstance (); Context.addMessage (empty, new FacesMessage ("error message")); Return;    What was the problem?   

The message tag is incorrect, you have

  t: message   

and this

  t: Message   

After checking for the rest of the configuration, after completing everything, this tag works perfect with your code.

No comments:

Post a Comment