Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1338

The page content will be empty when the Javascript takes a long time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.0, 6.0.3
    • 6.0.2
    • ZK Client Engine
    • None

      For example,

      <?page title="If nothing in the page, that is a bug"?>
      <?script content="zk.log('if nothing in the page, that is a bug')"?>
      <zk xmlns:w="http://www.zkoss.org/2005/zk/client">
      <zscript><![CDATA[
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      
      import org.zkoss.lang.Threads;
      import org.zkoss.web.util.resource.ClassWebResource;
      import org.zkoss.zk.ui.Component;
      import org.zkoss.zk.ui.http.WebManager;
      import org.zkoss.zk.ui.http.WpdExtendlet;
      import org.zkoss.zk.ui.util.GenericForwardComposer;
      import java.io.IOException;
      
      public class MyComposer extends GenericForwardComposer {
      	ClassWebResource cwr;
      	public void doAfterCompose(Component comp) throws Exception {
      		super.doAfterCompose(comp);
      		cwr = WebManager.getWebManagerIfAny(comp.getDesktop().getWebApp()).getClassWebResource();
      		cwr.addExtendlet("wpd", new MyWpdExtendlet());
      	}
      	class MyWpdExtendlet extends WpdExtendlet {
      		public void service(HttpServletRequest request,
      		HttpServletResponse response, String path) throws ServletException, IOException  {
      			if (path.indexOf("mesh.wpd") >= 0) {
      				if (cwr != null)
      					cwr.addExtendlet("wpd", new WpdExtendlet());
      				Threads.sleep(3000);
      			}
      			super.service(request, response, path);
      		}
      	}
      }
      ]]></zscript>
      	<window id="mainWin" border="normal" width="800px" vflex="1"
      		apply="MyComposer">
      		<custom-attributes org.zkoss.zul.image.preload="true"/>
      		<zscript><![CDATA[
      			ListModel model = new FakeListModel(40);
      		]]></zscript>
      		<caption label="Join ZK">
      			<hlayout>
      				<label id="curr_step" value="0" />
      				%
      				<progressmeter id="curr_met" value="0" width="300px" />
      			</hlayout>
      		</caption>
      		<listbox model="${model}" vflex="1">
      			<template name="model">
      				<listitem>
      					<listcell label="${each}"/>
      				</listitem>
      			</template>
      		</listbox>
      	</window>
      </zk>
      

            jumperchen jumperchen
            jumperchen jumperchen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: