锁定老帖子 主题:如何深入学习ww ui tag
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2006-10-10
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2006-10-10
webwork自己的quickstart demo不就足够详细了吗?
|
|
返回顶楼 | |
发表时间:2006-10-10
robbin 写道 webwork自己的quickstart demo不就足够详细了吗?
谢谢你的回复.我主要看了showcase,可是demo毕竟是demo,它不是为我们自己的应用量身定做的,真实的应用总是有一些特别的需求,我希望有一种思路,当碰到ui tag方面的问题,我该怎样优雅地解决,是读源代码吗该如何顺藤摸瓜找到key point?也可以上论坛求助,或者依照demo画瓢,这样好像都是洪水来了采用堵的方式 |
|
返回顶楼 | |
发表时间:2006-10-10
<ww:elseif test="username 不为空且长度大于0 "> 这样一个语句怎么写啊,我不懂。 |
|
返回顶楼 | |
发表时间:2006-10-10
我觉得足够了,反正我就是看那个demo,外加文档学会的。剩下的就要看实践当中摸索了。
|
|
返回顶楼 | |
发表时间:2006-10-10
<ww:elseif test="username != null && username.length > 0">
|
|
返回顶楼 | |
发表时间:2006-10-10
是不是在test里可以随便写java程序的啊?
|
|
返回顶楼 | |
发表时间:2006-10-10
robbin 写道 我觉得足够了,反正我就是看那个demo,外加文档学会的。剩下的就要看实践当中摸索了。
这是一个层次的问题,不是每个人都有这样的条件,否则现在国内翻译书都不会有销路了。 对于一些水平还不是够高的人来说(如敝人),虽然再主动的学习,花费的时间还是相当的多的。 唉,成长的烦恼~~ |
|
返回顶楼 | |
发表时间:2006-10-11
我的经验:
看taglib的文档,然后去看源码中的freemarker文件。 比如,想知道list的headerKey、headerValue究竟是怎么回事,看一下源码就知道了 <#if parameters.headerKey?exists && parameters.headerValue?exists> <option value="${parameters.headerKey?html}">${parameters.headerValue?html}</option> </#if> |
|
返回顶楼 | |
发表时间:2006-10-11
首先我们要明白tag,template,theme的含义和相互的关系。
引用 * tag - a small piece of code executed from within JSP, FreeMarker, or Velocity.
* template - a bit of code, usually written in FreeMarker, that can be rendered by certain tags (HTML tags) * theme - a collection of templates packaged together to provide common functionality tag会指定使用哪个template,这个template是哪个theme里的呢需要指定 引用 Themes can be selected using several different rules, in this order:
1. The theme attribute on the specific tag 2. The theme attribute on a tag's surrounding form tag 3. The page-scoped attribute named theme 4. The request-scoped attribute named theme 5. The session-scoped attribute named theme 6. The application-scoped attribute named theme 7. The webwork.ui.theme property in webwork.properties (defaults to xhtml) A few important concepts come from this order: * You can override an entire form's theme by only changing the theme attribute for the forum. This makes it easy to use the ajax theme in just a few select places. * You can change the theme for a user's session. This might be useful if users can customize their look and feel. * If you want to change the theme for the entire application, adjust your webwork.properties. 有些时候我们需要创建我们自己的template 引用 Because most of the templates you will need are included in the WebWork jar (the classpath), you may find a few situations where you need to override a particular template to provide behavior that is unique to your application. For example, you might wish to change how select tags render. Rather than creating a brand new template and changing every tag to use that template, you can override the built in select.ftl template by copying the file from in the jar over to a new /template/xhtml/select.ftl directory.
好的fremarker技能就很必要了 或者干脆创建我们自己的theme 引用 wrapping an existing theme
Taking a look at the xhtml theme, we can see that the templates there make extensive use of a wrapping technique. For example, a template might look like: <#include "/${parameters.templateDir}/xhtml/controlheader.ftl" /> <#include "/${parameters.templateDir}/simple/xxx.ftl" /> <#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /> This template is simply wrapping the simple theme's existing template with a header and a footer. This is a great way to add additional behavior around the basic HTML elements provided by the simple theme. extending an existing theme The theme infrastructure provided by WebWork also allows themes to extend an existing theme. What this means is that a theme may contain a theme.properties with a parent entry that contains the name of the theme that you would like to extend. For example, the ajax theme extends the xhtml theme in this way. By extending a theme, you are not required to implement every single template that the Tags use. Rather, you only need to implement templates that you wish to override. All other templates will be loaded from the parent template. wrapping & extending 可以一起用来create 我们自己的theme,they do not conflict with each other. 所以我认为如果要深入认识ui tag,我们得先修炼fremarker,还得好好看看ww提供的那几个themes,根据需要做一些工作。使用tag的时候也可以看看这些ftl文件,就能明白一些。 BTW,这里我们讨论的是ui tag。 Regards. |
|
返回顶楼 | |