waterye

Taconite

Taconite is a J2EE-based framework for simplifying Ajax development. Taconite includes a client-side JavaScript library and custom JSP tags that automate the Ajax request and generating dynamic content.

Hello World
index.html
 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 2
 3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 4    <head>        
 5        <script type="text/javascript" src="taconite-client.js"></script>
 6        <script type="text/javascript" src="taconite-parser.js"></script>
 7        
 8        <script type="text/javascript">
 9            function doHelloWorld(url) {
10                var ajaxRequest = new AjaxRequest(url); //Create AjaxRequest object
11                ajaxRequest.sendRequest();  //Send the request
12            }

13        
</script>
14    </head>
15    <body>
16        <href="javascript:doHelloWorld('example-jsp.jsp');">Hello World (JSP parser)</a>
17        <br/>
18        <href="javascript:doHelloWorld('example-all.jsp');">Hello World (Any server-side tech)</a>
19
20        <br/><br/>
21        <div id="helloWorldContainer">
22                
23        </div>
24    </body>
25</html>
example-jsp.jsp
 1<%@ taglib uri="http://taconite.sf.net/tags" prefix="tac" %>
 2
 3<tac:taconiteRoot>
 4    <tac:appendAsChildren contextNodeID="helloWorldContainer" parseOnServer="true">
 5    
 6       <div style="font-weight:bold;color:red;">
 7           Taconite says: Hello World!!!
 8       </div>
 9       <%           
10           out.println("free");    // 太亲切了, 好free啊 
11       %>
12       
13    </tac:appendAsChildren>
14</tac:taconiteRoot>
example-all.jsp
 1<%@page contentType="text/xml"%>
 2
 3<taconite-root xml:space="preserve">
 4    <taconite-append-as-children contextNodeID="helloWorldContainer" parseInBrowser="true">
 5    
 6       <div style="font-weight:bold;color:orange;">
 7           Taconite says: Hello World!!!
 8       </div>
 9        
10    </taconite-append-as-children>
11</taconite-root>


详细参考: depoly taconite-test.war后, http://localhost:8080/taconite-test

BTW: 完全没有xml配置这种麻烦事啊, 太好了

posted on 2005-12-02 19:42 waterye 阅读(1017) 评论(3)  编辑  收藏

Feedback

# re: Taconite 2005-12-03 11:18 江南白衣@ITO

你这个例子里都没有Java对象的串行化或者RPC,肯定不需要XML配置啦:)

一般的ajax框架都是返回一段xml或者html给客户端,客户段再用javascript进行安插.
他这样在服务端用tag连安插的javascript也封进去是一种思路.

不知道他一共支持多少种操作.  回复  更多评论   

# re: Taconite 2005-12-03 13:12 Water Ye@ITO

以这种方式封装的最大好处是方便js开发员和java开发员角色分离

此项目在sf的注册时间 : 2005-06-16 10:32
cvs上增加了remoteRequest.js, 但taconite-test.war中没有相关的例子

tag的操作有insert, append, delete, replace等方式  回复  更多评论   

# re: Taconite 2006-01-02 11:09 Water Ye@ITO

1.5 release
http://sourceforge.net/project/memberlist.php?group_id=141631  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: