Today I created a custom JSF 2 Composite Component, but Mojarra threw an error on me, when I tried to use a German Umlaut like ü in my markup, like this
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.servlet.ServletException: javax.faces.view.facelets.FaceletException: Error Parsing /resources/sg/uploadedDoc.xhtml: Error Traced[line: 45] The entity "uuml" was referenced, but not declared.
root cause
javax.servlet.ServletException: javax.faces.view.facelets.FaceletException: Error Parsing /resources/sg/uploadedDoc.xhtml: Error Traced[line: 45] The entity "uuml" was referenced, but not declared.
root cause
java.util.concurrent.ExecutionException: javax.faces.view.facelets.FaceletException: Error Parsing /resources/sg/uploadedDoc.xhtml: Error Traced[line: 45] The entity "uuml" was referenced, but not declared.
root cause
javax.faces.view.facelets.FaceletException: Error Parsing /resources/sg/uploadedDoc.xhtml: Error Traced[line: 45] The entity "uuml" was referenced, but not declared.
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.0.1 logs.
The reason this happened is, that I referenced an entity “uuml;” in a xml document where it is not defined.
XML basically just supports a few build-in entities, like “amp;” “quot;”, “apos;”, “lt;” and “gt;”.
To let the SAX-Parser know which additional entities I wanted to use, I simply added the XHTML 1.1 DOCTYPE to the head of the document.
My Component now looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:composite="http://java.sun.com/jsf/composite"> <body> <composite:interface> .... </composite:interface> <composite:implementation> .... text Übermorgen ist auch noch ein Tag ... text </composite:implementation> </body> </html> |
Hope this helps some of you out there.
1 Response to JSF Components – The entity “uuml” was referenced, but not declared
matt
February 16th, 2011 at 02:05
You’re showing the XHTML 1.0 DOCTYPE here. Anyway, when I use 11 the entities are recognized but Umlauts still don’t show up. Any ideas?