web.xml warning "CHKJ4019W: Invalid res-sharing-scope; valid values are "Shareable" or "Unshareable"

what?
I have this warning from vary vary time ago. And only today i decided to investigate.
And i find a solution: adding a res-sharing-scope tag inside the resource-ref tag, and exactly:


<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/DB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

Error Messages with JSF

If your method throws an exception or, more generally, there is a controlled error or warning and you must show to user this error then you can add a FacesMessage in your JSF page in this way:

try {
yourCode...;

}
catch (YourApplicationException e) {
FacesMessage messaggio=new FacesMessage(e.getMessage());
FacesContext context=FacesContext.getCurrentInstance();
context.addMessage(null,messaggio);
return null;
}

In your jsp page you have to add this code:

<h:messages globalOnly="true" />

The globalOnly attribute because it will display all generic error messages, those messages with the first parameter of addMessage method equals to null.
If you want display errors about a single field the you must specify the "validator" attribute of that field!

Theoretically, you could specify the id field in the first parameter of "addMessage" method but with JSF 1.1 seems not work!