`
dengyin2000
  • 浏览: 1219129 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

对Tapestry的一点思考。

阅读更多
Tapestry5已经开发了蛮久了。 听说最近要发布T5.0.7了, 会加上Ajax的功能。 我觉得Tapestry5丢掉了Tapestry的一个非常重要的优点和特色, 那就是把jwcid换成了用xml namespace定义组件了。 这样的话跟jsp里使用tag没什么区别。 很多人当初使用tapestry也是冲着Tapestry能够非常好的预览html, 不会像jsp那样, tag把html页面弄得支离破碎。 这样能够拉近程序员和美工之间的距离,提高工作效率。 如果tapestry还是使用这种方式。 我觉得struts2是更好的选择。

最近也是因为我帮组公司中的其他项目修改页面有感而发的。 那个项目使用seam, 在调整jsf中的dateTable组件时非常不爽。

感觉Tapestry可能马上会没落下去。 T5搞了这么久都还没有release。 所以也有了一点小的想法。 能不能对T4进行改造, 用spring替换hivemind, 把page class可以向T5那样用个pojo。提高T4的效率。 其实直接点的话就是把T5的page template的写法换回成T4的方式。 使用jwcid。

分享到:
评论
6 楼 dengyin2000 2008-02-01  
准备投入到jboss seam中了。  虽然不喜欢JSF。 但是有工具的支持还是比较喜人。现在正在读Java Server Faces: The Complete Reference. 感觉还可以。
5 楼 Linuxboy 2008-02-01  
问题在于,T5还使用了新的扩展名tml,而不是原来的html.
4 楼 lucky121 2008-01-02  
喜欢T4,不喜欢T5,也是感觉它越来越回去了。
这次升级变动太大,不喜欢这种风格。
3 楼 koda 2007-12-31  
不可否认的是,Tapestry5实在让人等的花儿都谢了
Java WebFramework在web2.0这一波的确有点落伍。
几乎没有新创,一方面Java崇尚ROR(Tapestry),一方面向.net靠拢(Seam).却一直作为不多

2 楼 dengyin2000 2007-12-28  
不好意思 昨天晚上头脑发热了。 以前搞过一个项目,是用的input type="select" t:id="sex" t:type="Select"  这种写法的。   好久没用T5了。
1 楼 tapestry 2007-12-28  
T5完全可以用T4的方式,不过将jwcid改为了t:type来申明类型,两种方式是可选的。
例如:
<html t:type="layout/default" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<form t:type="form" t:id="userForm">
      <table>
        <tr>
          <td colspan="2">
            <t:errors />
          </td>
        </tr>
        <tr>
          <td>
            <label for="name" t:type="label" accesskey="F">姓名:</label>

            <span class="required">*</span>
          </td>

          <td>
            <input type="text" t:id="name" t:type="TextField" value="user.name"  t:validate="required,maxlength=10" />
          </td>
        </tr>

        <tr>
          <td>
            <label for="password" t:type="label" accesskey="E">密码:</label>

            <span class="required">*</span>
          </td>

          <td>
<input type="hidden" t:id="password" t:type="PasswordField" value="user.password"   t:validate="required,maxlength=10" />
          </td>
        </tr>
           <tr>
          <td>
            <label for="sex" t:type="label" accesskey="E">性别:</label>

            <span class="required">*</span>
          </td>

          <td>
<input type="select" t:id="sex" t:type="Select" value="user.sex"   model="sexSelectModel"/>
          </td>
        </tr>

        <tr>
          <td>
          </td>

          <td id="submit">
            <input type="submit" value="Submit" class="submit" />

            <input type="reset" value="Reset" class="submit" />
          </td>
        </tr>
      </table>
    </form>
</html>

官方上的介绍
Invisible Instrumentation

A favorite feature of Tapestry 4 is invisible instrumentation, the ability to mark ordinary HTML elements as components. Invisible instrumentation leads to more concise templates that are also more readable.

For Tapestry 5, you make use of namespaced id or type attributes to mark an arbitrary element as a component, for example:

<p>
    Merry Christmas:
    <span t:type="Count" end="3">
        Ho!
    </span>
</p>

The id, type and mixins attributes must be placed in the Tapestry namespace. Any additional attributes may be in the Tapestry namespace or in the default namespace. Placing an attribute in the Tapestry namespace is useful when the attribute is not defined for the element being instrumented.

A component must have a type, either via the t:type attribute in the template, or by the defining the component in the Java class using the Component annotation (and using the t:id attribute on the element in the template).

In most cases,it is an aesthetic choice between normal emebedded components, and embedded components via invisible instrumentation. In a few instances, such as the Loop component, the behavior of the component is influenced by your choice. The Loop component, when included using invisible instrumentation, will render the tag and any informal parameters, around its body. Thus, for example:

  <table>
    <tr t:type="loop" source="items" value="item" class="prop:rowClass">
      <td>${item.id}</td>
      <td>${item.name}</td>
      <td>${item.quantity}</td>
    </tr>
  </tabel>

Here, the loop component "merges into" the <tr> element. It will render out a <tr> for each item object in the items list. It will write a dynamic class attribute into each <tr>.

相关推荐

    tapestry官方中文文档

    Tapestry是一款强大的Java Web应用程序框架,由Apache软件基金会维护,它强调了组件化、模块化和可重用性,使得开发复杂的Web应用变得更加简单。本文将深入介绍Tapestry 4的相关知识点。 1. **组件化编程**: ...

    tapestry源码 api等

    以下是对Tapestry源码、API及相关库的详细解读: 1. **Tapestry Core**: 这是Tapestry框架的基础部分,包含了核心组件、服务容器(Tapestry IoC)和页面生命周期管理。通过源码分析,我们可以理解其如何实现页面...

    Tapestry简单入门.rar_java Tapestry_tapestry

    Tapestry是一款强大的Java Web应用程序框架,由Apache软件基金会维护,它提供了一种基于组件的模型来构建动态、数据驱动的Web应用。本教程将帮助初学者了解Tapestry的基本概念,带你逐步入门并掌握其核心组件的使用...

    Tapestry4开发指南

    Hivemind,同样由Howard开发,是一个轻量级的IoC(Inversion of Control)容器,用于管理对象间的依赖关系,使得Tapestry4不仅能够构建Web应用,还能通过对Hivemind的利用,实现框架自身的高度定制化。 #### 二、...

    tapestry教程资料文档合集

    Tapestry5最新中文教程.doc 作者 Renat Zubairov & Igor Drobiazko译者 沙晓兰 发布于 2008年7月2日 下午9时30分 社区 Java 主题 Web框架 ----------------------------------------- Tapestry5.1实例教程.pdf ...

    tapestry学习入门资料

    "tapestry学习入门资料" Tapestry 是一个开源的基于 servlet 的应用程序框架,它使用组件对象模型来创建动态的、交互的 web 应用。 Tapestry 使得 Java 代码与 HTML 完全分离,利用这个框架开发大型应用变得...

    tapestry3开发指南,带tapestry3所有jar包

    **Tapestry 3 开发指南** Tapestry 3 是一个开源的Java Web应用程序框架,它在20世纪90年代末至21世纪初非常流行,由Apache软件基金会维护。这个框架提供了组件化、事件驱动和声明式编程模型,帮助开发者构建动态、...

    tapestry5.2.6 jar包

    5. **持久层集成**:Tapestry与Hibernate等ORM框架无缝集成,简化了数据库操作,如tapestry-hibernate模块,它提供了对Hibernate的支持。 6. **Spring集成**:通过tapestry-spring模块,Tapestry可以与Spring框架...

    Tapestry通用WEB框架

    Tapestry是一个强大的Java Web应用程序框架,由Apache软件基金会维护。它旨在提高开发效率,提供高度模块化和可重用的组件,以及优秀的错误处理和调试能力。在深入探讨Tapestry的知识点之前,让我们先了解一下这个...

    tapestry5中文文档

    Tapestry 5 强调易用性,不仅对终端用户友好,同时也优化了开发者的体验。它具有类重载特性,允许开发者在修改代码后立即看到效果,无需重新部署。此外,Tapestry 提供详细的异常报告,有助于快速定位和解决问题。 ...

    tapestry5以上的帮助事例,帮助文档与spring衔接文档

    Tapestry是一个基于控件的框架以致于用它开发Web应用类似开发传统的GUI应用。你用Tapestry开发Web应用时你无需关注以操作为中心的(Operation-centric) Servlet API.引用Tapestry网站上的一句话:"Tapestry用对象...

    Tapestry 5 電子書

    《Tapestry 5 電子書》是关于Java Web开发框架Tapestry 5的一本详尽指南,由Packt Publishing在2007年出版。这本书旨在帮助开发者深入理解和掌握Tapestry 5的各个方面,从而利用其强大功能构建高效、可维护的Web应用...

    深入浅出tapestry

    , 为了方便读者在应用Tapestry框架时对各种知识点进行查阅,本书的各个章节相互独立,因此本书不但可以作为一部学习教程,也可以作为一本工具参考书。, 本书适合Web框架技术的爱好者、Tapestry入门学习者、Tapestry...

    tapestry 实例

    4. **国际化与本地化**:内置对多语言支持,方便实现应用的国际化。 **五、Tapestry 学习资源** 1. **官方文档**:Apache Tapestry 提供了详尽的官方文档,包括快速入门、API参考和示例项目。 2. **社区支持**:...

    Tapestry API

    Tapestry提供了一系列的测试工具,如`PageTester`,允许开发者对页面和组件进行单元测试,确保代码质量。 Tapestry API的详细文档,即`apidocs`,包含了所有这些概念的详细解释和示例,是开发者深入理解和使用...

    Tapestry5.0.16_API文档

    Tapestry5.0.16文档和大家一起学习

    tapestry-4.0.zip

    另外,Tapestry 4.0 提供了对AJAX的支持,允许开发者构建动态和交互性强的Web应用,尽管那时AJAX技术尚未像后来那样广泛流行。通过使用Tapestry的AJAX API,开发者可以更新页面的一部分而无需刷新整个页面,提升用户...

    Tapestry4.1.2 入门-介绍

    【Tapestry4.1.2 入门-介绍】 Tapestry 是一个基于Java的Web应用程序框架,它提供了一种面向组件的开发方式,极大地简化了Web应用的构建过程。在Tapestry中,开发者无需关注HTTP请求的处理细节,如链接、请求流向和...

Global site tag (gtag.js) - Google Analytics