开发者社区> 问答> 正文

ZK框架 初学demo就报错 惆怅啊!?报错

可怜悲催的,公司让外包做的项目马上要拿回来接手,尼玛我一看代码竟然用的ZK,这哪会啊,没办法学呗,我也很诧异为啥外包那边不用点与时俱进的框架,当然我不是说ZK的不好。

言归正传,我下载下来了demo按照demo敲了个hello界面都报错很是奇怪,大家帮我看看吧

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
	xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>ZK</display-name>
	<listener>
		<description>ZK listener for session cleanup</description>
		<listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class>
	</listener>
	<!--DHtmlLayoutServlet负责加载页面,接收请求时根据定义创建组件  -->
	<servlet>
		<description>The ZK loader for ZUML pages</description>
		<servlet-name>zkLoader</servlet-name>
		<servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
		<init-param>
			<param-name>update-uri</param-name>
			<param-value>/zkau</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<!--DHtmlUpdateServlet负责处理ZK的事件请求 基于Ajax  -->
	<servlet>
		<description>The asynchronous update engine for ZK</description>
		<servlet-name>auEngine</servlet-name>
		<servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>zkLoader</servlet-name>
		<url-pattern>*.zul</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>zkLoader</servlet-name>
		<url-pattern>*.zhtml</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>auEngine</servlet-name>
		<url-pattern>/zkau/*</url-pattern>
	</servlet-mapping>

	<welcome-file-list>
		<welcome-file>index.zul</welcome-file>
	</welcome-file-list>
</web-app>



test1.zul:
<window title="我的第一个窗口" border="normal" height="200px" width="300px" 
	closable="true" sizable="true">
		Hello ZK!
		<button label="Hi" onClick='alert("Welcome")'/>
</window>



 至于zk.xml嘛  我这是简单的测试  里面没有写什么

启动不会报错,一加载test1.zul就报错,貌似是解析xml报错什么的我也看不明白,没经验啊,主要是这句:Invalid byte 2 of 2-byte UTF-8 sequence.

详细报错信息: 

2014-5-21 8:47:54 org.zkoss.web.util.resource.ResourceCaches get:126
警告: Unable to load C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.26\webapps\ZK\test1.zul
>>com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.
>>	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:674)
>>	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:362)
>>	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
>>	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanLiteral(XMLEntityScanner.java:1064)
>>	at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(XMLScanner.java:813)
>>	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:460)
>>	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:277)
>>	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
>>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
>>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
>>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
>>	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
>>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
>>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
>>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
>>	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
>>	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
>>	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
>>	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
>>	at javax.xml.parsers.SAXParser.parse(SAXParser.java:331)
>>	at org.zkoss.idom.input.SAXBuilder.build(SAXBuilder.java:298)
>>	at org.zkoss.zk.ui.metainfo.Parser.parse(Parser.java:99)
>>	at org.zkoss.zk.ui.metainfo.PageDefinitions$MyLoader.parse(PageDefinitions.java:209)
>>...




展开
收起
爱吃鱼的程序员 2020-06-20 17:36:37 511 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    <spanstyle="font-family:微软雅黑,Verdana,sans-serif,宋体;font-size:14px;line-height:22px;background-color:#FFFFFF;">test1.zul要用UTF-8格式<spanstyle="font-family:微软雅黑,Verdana,sans-serif,宋体;font-size:14px;line-height:22px;background-color:#FFFFFF;">保存对的猜测是BOM的原因

    2020-06-20 17:36:54
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
gohbase :HBase go客户端 立即下载
RocketMQ Client-GO 介绍 立即下载
探究 Node.js 的服务端之路 立即下载

相关实验场景

更多