-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi!
In my ZK application, I have a customized error ZUL page, when some error occurs:
<error-page> <exception-type>java.lang.Throwable</exception-type> <location>/WEB-INF/zul/common/error.zul</location> </error-page>
My problem is that some interface failures show a message box with ZK default style (and ZK title). This happens, for instance, when SizeLimitExceededException is thrown in too big file upload.
I would like to customize this kind of messages (text and appearance), but I don't find a valid solution.
Does anyone have any ideas?
My tries were:
1. Customize org.zkoss.zk.au.http.AuUploader, overriding handleError method. With this, I only customize error text message, that is not enough.
2. Customize org.zkoss.zul.Messagebox, setting template with setTemplate method on application startup. With this, I customize default messagebox template, but is not used in SizeLimitExceededException error popup.
Thanks.
Hi xeridia,
The system's exception will handle by error-page setting, but the ZK's exception (like size limit exception of file upload) will handle by ZK itself.
According to your requirement, my suggest is override the jq.alert() method, like this:
<zk> <script> jq.alert = function (msg, opts) { alert("ERROR!"); } </script> <button label="Upload error" upload="true, maxsize=1"/> </zk>
Notice: It has global effect with other component which use this function on the same zul.
Reference:
http://books.zkoss.org/wiki/ZK_Client-side_Reference/General_Control/Widget_Customization
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/dom.js
http://www.zkoss.org/javadoc/6.5.0/jsdoc/_global_/jq.html#alert(_global_.String, _global_.Map)
Regards,
Monty Pan
Asked: 2012-11-14 13:32:22 +0800
Seen: 237 times
Last updated: Nov 15 '12