zoukankan      html  css  js  c++  java
  • Tapestry5 Setup with HTML5 and jQuery

    Partly learning from past experiences, but mainly because of future requirements regarding mobile development, I am looking to create a Tapestry5 project setup that uses jQuery instead of Prototype and can output HTML5.

    Make Tapestry5 accept HTML5 Doctype

    Tapestry5 uses a Parser to validate the correctness of documents. They have to be proper XML and contain a DTD. This is great, as it makes us to write proper web documents. The issue with HTML5 is that it does not contain a DTD. HTML5 is kind of a step back and two steps forward. It’s less strict than XHTML (like HTML4) but adds loads of useful stuff from the “real world” by maintaining backwards compatibility. For a short but very good introduction I recommend Jeremy Keith “HTML5 for Web Designers”.

    To be able to use HTML5 with Tapestry5 there is a workaround documented in Tapestrys issue database as “Allow HTML5 doctype to be printed“. It includes a little patch that is applied to the org.apache.tapestry5.dom.DTD class. I did create a copy of that class in my project, applied the patch and am running happily HTML5 since then. All I need to do is to keep an eye on updates on that class to not miss any, possibly crucial, changes.

    Replacing Prototype with jQuery

    By default Tapestry 5 ships with the Prototype/Scriptaculous JS Stack. Though there is no issue with that, jQuery simply seems to be the thing right now, with a much more lively development and broad acceptance among users. All that aside, specifically the jQuery Mobile Framework has caught my attention. It is optimized for touchbased Smartphones such as the iPhone, Android, Windows 7 and more. Since it is Browser based, you will be able to ship a product for all those phones without too much of customization involved. Simply use your good old and proven Web development knowledge.

    So, back to Tapestry5. There has been a clever enhancement that replaces prototype completely with jQuery. Most of the components do work out of the box, for more details read the got5 tapestry5-jquery project page. Follow the instructions on that page for including their dependency into your pom.xml (I did replace version 1.0.0-SNAPSHOT with version 1.1.0-SNAPSHOT) And that’s it!

  • 相关阅读:
    Nginx开发从入门到精通
    Nginx配置文件(nginx.conf)配置详解
    转贝叶斯推断及其互联网应用(一):定理简介
    Vim 使用入门快捷键
    从贝叶斯定理说开去
    转特征值和特征向量
    第四章 特征值与特征向量
    numpy基础入门
    python range函数与numpy arange函数
    转悠望南山 Python闲谈(二)聊聊最小二乘法以及leastsq函数
  • 原文地址:https://www.cnblogs.com/kevinhigher/p/2171893.html
Copyright © 2011-2022 走看看