-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I have issues with jsp error page. The jsp itself is very simple and works when accessed directly by URL. It is mapped in zk.xml as error-page, but in case of error I got the following :
SEVERE: Unable to generate custom error page, error.jsp
>>org.zkoss.lang.SystemException: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
There are some more checks ZK does in addition to the servlet container. Does ZK support non-zul error pages? Ideas ?
ZK 6.0.2, Tomcat 6.0.29, Java 1.6.0.35
Aleksandar
Hello,
Hello,
here you are -
zk.xml :
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>error.jsp</location>
</error-page>
error.jsp :
<%@page import="org.slf4j.Logger,org.slf4j.LoggerFactory;" %>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>...</title>
<link href="<%=request.getContextPath()%>/assets/style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
...some pretty page here ...
</body>
</html>
<% Logger logger = LoggerFactory.getLogger("UI errors");
logger.error("error message", request.getAttribute("javax.servlet.error.exception")); %>
Once again, the page is valid and is rendered when accessed directly, but fails when for example Composer or .zul throws an exception with the above error.
Thank you in advance!
Aleksandar
Hi, refer to the Error Handling
put setting to web.xml
for example, in web.xml
<error-page> <exception-type>java.lang.Throwable</exception-type> <location>/WEB-INF/error.jsp</location> </error-page>
and the error.jsp file works file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> Error test </body> </html>
I.e. astoev, you should use the web.xml file and not the zk.xml file ;)
Hello there,
I have tested the code offered by samchuang. For some reason I got :
SEVERE: Unable to generate custom error page, /WEB-INF/error.jsp
>>org.zkoss.lang.SystemException: org.xml.sax.SAXParseException: The declaration
for the entity "HTML.Version" must end with '>'.
>>org.xml.sax.SAXParseException: The declaration for the entity "HTML.Version" m
ust end with '>'.
Steva77, thank you for your comment also, I have the error page declaration in both web.xml and zk.xml. If I omit the zk.xml it is just not processed.
Any other thoughts?
Thank you,
Aleksandar
Try to regenerate with the wizard a brand new default error.jsp... it might be copy&paste from here imported some bad character...
Hello Steva77,
I also think the problem might be some strange character. I created new jsp page (again) with the Eclipse wizzard and the result is the same : SAXParseException: The markup in the document preceding the root element must be well-formed.
What else could it be?
Best Regards,
Aleksandar
Asked: 2012-10-10 13:11:09 +0800
Seen: 147 times
Last updated: Nov 01 '12