0

Failed to load media with Iframe on ZK 5.0.8 use IE9

asked 2012-01-30 09:45:12 +0800

TonyHuynh gravatar image TonyHuynh
24

I have a problem when close page view file PDF in IE9, I use ZK 5.0.8
Message errors:
Jan 30, 2012 4:29:33 PM org.zkoss.zk.au.http.AuDynaMediar service:141
SEVERE: Failed to load media, /view/z_i920/hUGWge/mg91/1/iframe.pdf
>>org.zkoss.zk.ui.ComponentNotFoundException: Component not found: hUGWge
>> at org.zkoss.zk.ui.impl.DesktopImpl.getComponentByUuid(DesktopImpl.java:503)
>> at org.zkoss.zk.au.http.AuDynaMediar.service(AuDynaMediar.java:117)
>> at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:425)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>...

Can anybody help me? Thanks.
Tony

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2012-01-31 00:39:03 +0800

samchuang gravatar image samchuang
4084 4

hi

could you post sample code ?

link publish delete flag offensive edit

answered 2012-01-31 02:26:55 +0800

TonyHuynh gravatar image TonyHuynh
24

hi samchuang, this is code:
Page 1:

                        Map params = new HashMap();
			params.put("filePDF", filepdf);
                        final Window win;
			win = (Window) Executions.createComponents(
					"/sample.zul", null, params);
			try {
				win.doModal();
				pathfile = pathfile.substring(pathfile.lastIndexOf("/") + 1);
				if (reOpen == true) {
					if (pathfile.equals("")) {
						return;
					} else {
						String status = getStatus();
						if (status.equals("SGD")) {
                                                        // reOpen Page 2 use win.doModal()
							reOpen(filePCL, status);
						} else if (status.equals("PRT")) {
                                                        // Open Page Print use win.doModal()
							OpenPagePrint();
						}
					}
				} else {
					showMessageBox("not reopen!!!");
					return;
				}
                        } catch (Exception e) {
				e.printStackTrace();
			}

Page 2:

public void showPDF(String fileName) {
		if (fileName.equals(null) || fileName.equals("")) {
			return;
		}
		fileName = fileName.trim();
		log.info("Viewing " + fileName);
		Iframe iframe = (Iframe) this.getFellow("iframe");
		try {
			AMedia amedia = null;
			BufferedInputStream mediais = new BufferedInputStream(
					new FileInputStream(fileName));

			amedia = new AMedia(null, "pdf", "application/pdf", mediais);
			iframe.setStyle(amedia.getContentType());
			iframe.setContent(amedia);
			// mediais.close();
		} catch (Exception e) {
			log.info(fileName + " cannot be showed.");
			e.printStackTrace();
		}
	}

public void onClose(Event event) {
	this.detach();
}

message errors show when close Page 2.
Tony

link publish delete flag offensive edit

answered 2012-02-01 00:43:46 +0800

samchuang gravatar image samchuang
4084 4

Hi

can you debug which line in page 2 cause exception ? and which Component not found ?

link publish delete flag offensive edit

answered 2012-02-01 03:10:50 +0800

TonyHuynh gravatar image TonyHuynh
24

updated 2012-02-01 04:00:19 +0800

I have fix problem for IE9 but same a problem with IE8.
not exception but it's show:
Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience.

I think this is bug of IE8, samchuang, u have idea, please tell me!
thank you.
Tony

link publish delete flag offensive edit

answered 2014-04-16 03:59:18 +0800

Sam2012 gravatar image Sam2012
9

updated 2014-04-16 04:43:51 +0800

detach() is a bug for IE10, IE11 in my project

use onClose="self.setVisible(false);event.stopPropagation()", is OK

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-01-30 09:45:12 +0800

Seen: 338 times

Last updated: Apr 16 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More