kelly.zhang 发表于 2013-1-23 02:59:21

ajax框架之zk实例收藏

 ajax框架之zk实例收藏

<div class="blogstory">

<script type="text/javascript">function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>前 一段在网上看查找资料,无意间发现了一个 ajax框架的在线demo,被其华美的外表及简洁的代码风格所吸引,就开始了zk学习之路,经过两天的研究,发现这个框架确实不错,特别是它提供的例 子,基本实现了所有web开发的需要,它还对google map进行了封装,使其使用更加容易,不过,经这两天的学习,发现它的学习资料不是太多,找好长时间也找不到多少有用的,只好研究它自带的demo了,呵 呵,一段时间的研究,终于写出了一个小实例,现在提供出来,希望能对大家有帮助。该实例在 eclipse3.2+myeclipse+tomcat5.5+jdk5.0上运行成功。欢迎转载,有问题请联系我:txyhl@126.com首先,为了让大家对其有一个感性的认识,就先去看看它的demo,相信你也会被它华美的外表所吸引http://blog.csdn.net/Editor/FCKeditor/editor/images/smiley/msn/teeth_smile.gif,demo:<span style="color: rgb(255, 0, 0);" />http://www.potix.com/zkdemo/userguide/OK,ZK学习之路开始了。当然,要先去下载ZK,推荐网站:http://www.zkoss.org需要下载:zk-2.3.0.zip,现在的最高版本如果有兴趣,也可以下载<span style="font-family: monospace;">zk-demo-2.3.0.zip,里面有它的各种应用示例。新建一个WEB工程,工程名为:zktest然后将zk-2.3.0\dist\lib,zk-2.3.0\dist\lib\ext,zk-2.3.0\dist\lib\zkforge目录下面的jar包引入到工程中(怎么引入我不用说了吧)然后就开始写程序了......<span style="color: rgb(255, 0, 0);">web.xml<div style="padding: 4px 5.4pt; width: 95%;"><?xml version="1.0" encoding="UTF-8"?><web-app 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">    <listener>        <description>Used to cleanup when a session is destroyed</description>        <display-name>ZK Session Cleaner</display-name>        <listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class>    </listener>    <filter>      <filter-name>zkFilter</filter-name>      <filter-class>org.zkoss.zk.ui.http.DHtmlLayoutFilter</filter-class>      <init-param>        <param-name>extension</param-name>        <param-value>html</param-value> <!-- Use XHTML components as default. -->      </init-param>    </filter>    <filter-mapping>      <filter-name>zkFilter</filter-name>      <url-pattern>*.jsp</url-pattern>      <dispatcher>REQUEST</dispatcher>      <dispatcher>INCLUDE</dispatcher>      <dispatcher>FORWARD</dispatcher>      <dispatcher>ERROR</dispatcher>    </filter-mapping>    <servlet>        <description>ZK loader for ZUML pages</description>        <servlet-name>zkLoader</servlet-name>        <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>        <!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet).        It must be the same as <url-pattern> for the update engine.        -->        <init-param>            <param-name>update-uri</param-name>            <param-value>/zkau</param-value>        </init-param>        <load-on-startup>1</load-on-startup>    </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>        <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>auEngine</servlet-name>        <url-pattern>/zkau/*</url-pattern>    </servlet-mapping>    <!-- //// -->    <!-- /////////// -->    <!-- Miscellaneous -->    <session-config>        <session-timeout>120</session-timeout>    </session-config>        <welcome-file-list>        <welcome-file>index.zul</welcome-file>    </welcome-file-list></web-app>
页: [1]
查看完整版本: ajax框架之zk实例收藏