我的代码如下:
home.zul
<?page title="Home" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="Home" border="normal" maximizable="true" height="488px"
apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('com.company.login.HomePage')">
<borderlayout>
<north height="80px">
<hlayout>
<div>
<a image="/Image/books.png" id="image" onClick="@command('getImage')"/>
</div>
<space width="600px"/>
<menubar id="menubar" width="100%" autodrop="true">
<menuitem label="Home" />
<menu label="Library" >
<menupopup>
<menu label="JAVA">
<menupopup>
<menuitem label="Method Overloading" />
<menuitem label="Method Overriding" />
<menuitem label="Polymorpsim" />
</menupopup>
</menu>
<menuitem label="C++" />
<menuitem label="C#" />
<menu label="SELENIUM">
<menupopup>
<menuitem label="Selenium IDE" />
<menuitem label="Object Identification" />
<menuitem label="Handling Dynamic Obj" />
</menupopup>
</menu>
</menupopup>
</menu>
<menuitem label="Contact us" />
</menubar>
</hlayout>
</north>
<west width="170px">
<vlayout>
<tree id="tree" >
<treecols sizable="true">
<treecol label="Library" />
</treecols>
<treechildren>
<treeitem>
<treerow>
<treecell label="JAVA" />
</treerow>
<treechildren>
<treeitem>
<treerow>
<treecell> <toolbarbutton id="click1" label="Method Overloading" >
<attribute name="onClick">iframe.setSrc("http://www.javatpoint.com/method-overloading-in-java");
</attribute>
</toolbarbutton>
</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell> <toolbarbutton id="click2" label="Method Overriding" >
<attribute name="onClick">iframe.setSrc("http://www.javatpoint.com/method-overriding-in-java");
</attribute>
</toolbarbutton>
</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell> <toolbarbutton id="click3" label="Polymorpsim">
<attribute name="onClick">iframe.setSrc("http://www.javatpoint.com/runtime-polymorphism-in-java");
</attribute>
</toolbarbutton>
</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
<treeitem>
<treerow>
<treecell label="C++" />
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell label="C#" />
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell label="SELENIUM" />
</treerow>
<treechildren>
<treeitem>
<treerow>
<treecell> <toolbarbutton id="click4" label="Selenium IDE" >
<attribute name="onClick">iframe.setSrc("http://www.seleniumhq.org/docs/02_selenium_ide.jsp");</attribute>
</toolbarbutton>
</treecell>
</treerow>
</treeitem>
<treeitem >
<treerow>
<treecell> <toolbarbutton id="click5" label="Object Identification" >
<attribute name="onClick">iframe.setSrc("http://www.testinginterviewquestion.com/p/object-identification-in-selenium.html");</attribute>
</toolbarbutton>
</treecell>
</treerow>
</treeitem>
<treeitem >
<treerow>
<treecell> <toolbarbutton id="click6" label="Handling Dynamic Obj" >
<attribute name="onClick">iframe.setSrc("http://www.testerlogic.com/handling-dynamic-elements-in-selenium-webdriver/");</attribute>
</toolbarbutton>
</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
</treechildren>
</tree>
</vlayout>
</west>
<south height="30px">
</south>
<center>
<vlayout>
<iframe src="" id="iframe2" scrolling="true" width="50%" height="200px" ></iframe>
<iframe src="" id="iframe3" scrolling="true" width="50%" height="200px" ></iframe>
<iframe src="" id="iframe4" scrolling="true" width="50%" height="200px" ></iframe>
<iframe src="" id="iframe" scrolling="true" width="100%" height="750px" ></iframe>
</vlayout>
</center>
</borderlayout>
</window>
</zk>
HomePage.Java
package com.company.login;
import org.zkoss.bind.annotation.Command;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.Listen;
public class HomePage {
@Command
public void getImage(){
Executions.sendRedirect("/home.zul");
}
@Listen("onClick = #click1")
public void showModal() {
Execution execution = Executions.getCurrent();
execution.getParameter("myValue");
}
}
在运行上面的代码时,我收到了我的主页,但是当我尝试点击任何链接时,我收到一条错误消息,指出:“无法初始化类sun.net.www.protocol.http.HttpURLConnection “
请找到以下错误消息:
java.lang.NoClassDefFoundError: Could not initialize class sun.net.www.protocol.http.HttpURLConnection
at sun.net.www.protocol.http.Handler.openConnection(Unknown Source)
at sun.net.www.protocol.http.Handler.openConnection(Unknown Source)
at java.net.URL.openConnection(Unknown Source)
at org.zkoss.zkex.rt.Runtime.sendError(Unknown Source)
at org.zkoss.zkex.rt.Runtime.sendError(Unknown Source)
at org.zkoss.zkex.rt.Runtime.init(Unknown Source)
at org.zkoss.zkex.init.DesktopInit$RTInfoService.service(Unknown Source)
at org.zkoss.zk.ui.impl.DesktopImpl.service(DesktopImpl.java:750)
at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1317)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:606)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:482)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:490)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
请告诉我如何继续使用所有最新的罐子。