posts - 48, comments - 13, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

下载apache-maven-2.0.9-bin软件包,在path里加上了bin路径,运行mvn -version总是出现java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher 的错误,重新下载了maven-2.0.5-bin.zip将path路径改为\maven-2.0.5-bin\maven-2.0.5\bin,并增加了一个M2_HOME路径\maven-2.0.5-bin\maven-2.0.5,再次运行成功!在\maven-2.0.5-bin\maven-2.0.5\core\boot 路径下classworlds-1.1.jar包里就有要找的文件org.codehaus.classworlds.Launcher!

posted @ 2009-02-17 14:33 董锐 阅读(6147) | 评论 (0)编辑 收藏

在tapestry4中使用了session值,要记得在pageBeginRender中第一次进入清空,其后不需清空。

posted @ 2009-02-13 17:10 董锐 阅读(137) | 评论 (0)编辑 收藏

什么是Tapestry?
欢迎来到Tapestry世界!
本文是一篇帮助人们使用Tapestry5来创建应用程序的指导文章。不论你是否会使用Tapestry4(或Tapestry3)或者你对Tapestry完全陌生,都不影响你阅读此篇指南,事实上你对一般的互联网程序开发知道的越少,Tapestry则对你是越好的选择,因为你可以少学很多!
  当然你还是需要知道以下一些知识:HTML、XML,基本的Java语言特性和一些新一点的东西如Java Annotations.
如果你是用servlets、JSP或Struts来开发互联网应用程序的,或许你已对很多麻烦的事情习以为常了。或许你并没有意识到你所处的可怕处境。这些环境没有安全保障;Struts和Servlet API不知道你程序的架构是如何的,不知道各个不同的块是如何连接起来的。任何一个URL地址都可以是一个Action并且每个Action都可以前进到任何一个显示页面(通常是JSP页面),这些显示页面会生成返回到客户端浏览器的HTML页面。作为一个开发者,你必须要做出一系列永无止尽的小而重要的决定(并且要与你的开发团队进行协商),如actions、页面、属性等的命名规范、变量存放在HttpSession中还是存放在HttpServletRequest中等等,这些都是麻烦的事情。
传统方式将很多你不想要的东西推向你:多线程编程。还记得以前学习面向对象编程?一个对象可以定义为一组数据以及对这些数据进行操作的集合?当你开始互联网编程后你就必须忘记这个课程,因为互联网编程是多线程的。一个应用服务器可以处理来自单个用户的几十、上百个请求,每一个用户都有自己的线程,而且每一个用户都共享相同的对象。 突然,你发现不能在一个对象(一个servlet或一个struts Action)中存储数据,因为不论你为一个用户存放什么数据,它都会立马被某个其他用户的数据覆盖。
更糟的是,你的每个对象都有一个方法:doGet()或doPost()。
期间你每天工作的大部分内容是决定如何将你已经存储在java对象中的数据给打包然后把这些数据挤压进一个URL地址的请求参数里,然后你得再写些代码把这些数据给转换回来。同时要记得修改一大堆存储在servlet容器或Struts框架中的XML文件,让它们知道这些决定。

posted @ 2009-02-05 15:03 董锐 阅读(217) | 评论 (0)编辑 收藏

22 <component id="aPersonSelect" type="PropertySelection">
23 <binding name="model" value="ognl:personSelectModel"/>
24 <binding name="value" value="ognl:components.table.tableRow.aPerson"/>
25 </component>

ognl:OgnlException:source is null for getProperty(null, "aPerson")

错误描述:这是一个component中一个表A,还有一个表B,最初是表A显示,表B隐藏,显示没有问题,然后点击component中一个按钮,隐藏表A,显示表B,就出现这样的错误。

判断1:以为表A的数据源没有在Session保存,导致点击按钮重新装载页面时数据源为空,所以出现此错误,就将数据源改为session状态,还是有此错误
判断2:表A和表B是共用同一数据源,只是Column值有变化,修改为只用一个表,点击按钮时setColumn赋不同值,测试发现点击后表格内容没有变化,赋Column值失败
判断3:还是表A和表B,此次表A和表B使用不同数据源变量,点击按钮时表A数据表中内容选取部分赋给表B数据源,点击按钮,依然出现上述错误。

错误未解决:
待续。。。
-------------------------------------------
判断4:<td jwcid="aPersonColumnValue@Block"><span jwcid="aPersonSelect" /></td>
在.html文件中屏蔽此句,没有错误。
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
终于找到错误原因了:
原来表A和表B的列名相同,都用了aPerson,所以当显示表B时,为表A所用的<td jwcid="aPersonColumnValue@Block"><span jwcid="aPersonSelect" /></td>也为表B所用了,而表B的aPerson用的是:aPerson:aPerson.name,所以每次获取aPerson值都为空,修改表B的column为aPerson1:aPerson.name即成功!!
找了这么久,原来是这个错误,汗!!!!

posted @ 2009-02-01 10:57 董锐 阅读(219) | 评论 (0)编辑 收藏

如果propertySelection中是复杂对象,一定记得要重载public boolean equals(Object obj)方法才可以顺利选中初始值哦!

posted @ 2009-01-22 18:07 董锐 阅读(174) | 评论 (0)编辑 收藏

http://tapestry.apache.org/tapestry5/guide/persist.html

Most instance variables in Tapestry are automatically cleared at the end of each request.
通常每次请求结束,Tapestry会将实例变量清空。

This is important, as it pertains to how Tapestry pages are pooled and shared, over time, by many users.
这很重要,因为Tapestry的页面是在缓冲池中被许多用户共享的。

However, you often want to store some persistent data on a page, and have access to it in later requests.
然而,你通常希望在页面存储一些持久数据,这样后面的请求可以得到这些数据。

This is accomplished with the Persist annotation.

This annotation is applied to private instance fields.

  @Persist
private int value;

Annotated fields will store their state between requests. Generally, speaking, this means that the value is stored into the session (but other approaches are possible).

Whenever you make a change to a persistent field, its value is stored.

On later requests, the value for such persistent fields is reloaded from storage.



Persistence Strategies

The value for each field is the strategy used to store the field between requests.

session strategy

The session strategy stores field changes into the session; the session is created as necessary.

A suitably long session attribute name is used; it incorporates the name of the page, the nested component id, and the name of the field.

Session strategy is the default strategy used unless otherwise overridden.

Session策略是默认策略。

flash strategy

The flash strategy stores information in the session as well, just for not very long. Values are stored into the session, but then deleted from the session as they are first used to restore a page's state.

The flash is typically used to store temporary messages that should only be displayed to the user once.

client strategy

The field is persisted onto the client; you will see an additional query parameter in each URL (or an extra hidden field in each form).


Client  持久花费的代价要高些,它会在渲染页面的每个链接后面加上数百字节的额外信息。

Client persistence is somewhat expensive. It can bloat the size of the rendered pages by adding hundreds of characters to each link. There is extra processing on each request to de-serialize the values encoded into the query parameter.

Client persistence does not scale very well; as more information is stored into the query parameter, its length can become problematic. In many cases, web browsers, firewalls or other servers may silently truncate the URL which will break the application. 有时URL地址太长会被截掉。

Use client persistence with care, and store a minimal amount of data. Try to store the identity (that is, primary key) of an object, rather than the object itself.

posted @ 2009-01-21 16:49 董锐 阅读(216) | 评论 (0)编辑 收藏

Iterative Development and the unified process
People are more important than any process.
Good people with a good process will outperform good people with no process every time.
        --Grady Booch

Case Study: The NextGen PosSystem
Few things are harder to put up with than a good example.
        --Mark Twain

Inception
The best is the enemy of the good!
        --Voltaire

Understanding requirements
Ours is a world where people don't know what they want and are willing to go through hell to get it.
        --Don Marquis

Use-Case Model: Writing requirements in Context
The indispensable first step to getting the things you want out of life:decide what you want.
        --Ben Stein

Identifying other requirements
When ideas fail, words come in very handy.
        --Johann Wolfgang von Goethe

From inception to elaboration
The hard and stiff breaks. The supple prevails.
        --Tao Te Ching

Use-Case Model: Drawing System Sequence Diagrams
In theory, there is no difference between theory and practice. But, in practice, there is.
        --Jan L.A. van de Snepscheut

Domain Model: Visualizing Concepts
It's all very well in practice, but it will never work in theory.
        --anonymous management maxim

Domain Model: Adding Attributes
Any sufficiently advanced bug is indistinguishable from a feature.
        --Rich Kulawiec

Use-Case Model: Adding Detail With Operation Contracts
Fast, Cheap, Good: Choose any two.
    --anonymous

From Requirements to Design in this iteration
Hardware,n.: The parts of a computer system that can be kicked.
    --anonymous

Iteration Diagram Notation
 Cats are smarter than dogs. You can't get eight cats to pull a sled through snow.
    --Jeff Valdez

GRASP:Designing Objects with responsibilities
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
    --Nathaniel Borenstein

Design Model: Use-Case Realizations With GRASP Patterns
To invent, you need a good imagination and a pile of junk.
    --Thomas Edison

Design Model: Determining Visibility
A mathematician is a device for turning coffee into theorems.
    --Paul Erdos

Design Model: Creating Design Class Diagrams
To iterate is human, to recurse, divine.
    --anonymous

Implementation Model: Mapping Designs To Code
Beware of bugs in the above code; I have only proved it correct, not tried it.
    --Donald Knuth

GRASP:More patterns for assigning responsibilities
Luck is the residue of design.
    --Branch Rickey

Designing Use-Case Realizations with GoF Design Patterns
Anything you can do, I can do meta.
        --Daniel Dennett

Relating Use Cases
Why do programmers get Halloween and Christmas mixed up? Because OCT(31)=DEC(25)

Modeling Generalization
Crude classifications and false generalizations are the curse of the organized life.
    --A generalization by H.G.Wells

Refining the Domain Model
PRESENT, n. That part of eternity dividing the domain of disappointment from the realm of hope.
    --Ambrose Bierce

Adding new SSDs and Contracts
Virtue is insufficient temptation.
    --George Bernard Shaw

Modeling Behavior in statechart diagrams
Usability is like oxygen--you never notice it until it is missing.
  --anonymous

Designing the logical architecture with patterns
0x2B | ~0x2B
        --Hamlet

Organizing the design and implementation model packages
If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens?
    --Seymour Cray

Introduction To Architectual Analysis and the SAD
Error, no keyboard ~ press F1 to continue.
    --early PC BIOS message

Designing more use-case realizations with objects and patterns
On two occasions I have been asked (by memebers of Parliament), "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehand the kind of confusion of ideas that could provoke such a question.
     --Charles Babbage

Designing  a persistence framework with patterns
Time is a good teacher, but unfortunately it kills all its pupils.
    --Hector Berlioz

On drawing and tools
Bubbles don't crash.
  --Bertrand Meyer

Introduction to iterative planning and project isssues
Prediction is very difficult, especially if it's about the future.
    --anonymous

Comments on Iterative Development and the UP
You should use iterative development only on projects that you want to succeed.
    --Martin Fowler

posted @ 2009-01-19 03:59 董锐 阅读(210) | 评论 (0)编辑 收藏

    Analysis: do the right thing;
    Design: do the thing right!

posted @ 2009-01-19 03:10 董锐 阅读(113) | 评论 (0)编辑 收藏

今天中午急着打个新包发布,但是怎么打都打不成功,同样的build.xml,在自机器上运行也没有问题,怎么就打不成功呢,虽然知道不成功是因为class没有编译全,也就是说有一个java文件有问题,导致编译不全,但我在eclipse下把个各包是看了又看,没发现哪里有红叉叉啊,eclipse下没有红叉叉,但又编译有问题,我真是想不明白,越是急越是想不明白。
最后终于通过查看到底少了哪些class来逐个查看,终于找到那个问题文件了,打开那个文件,很明显的有个红条条显示问题在哪里,但是这个文件在eclipse目录下却没有红叉叉,本来文件里有红条条,对应目录应该有红叉叉,但是这个不知为什么没有,真是奇怪,算不算eclipse的BUG呢?

posted @ 2009-01-12 14:23 董锐 阅读(108) | 评论 (0)编辑 收藏

其他同事浏览器显示都正常,就只有一个同事显示为空白,浏览器下方状态栏里多了一个小黄色三角!(感叹)符号,点开来是IE管理加载项的界面。
这个同事禁用了很多加载项,后来一个一个试,将Shockwave Flash Object设为启用后,页面就可以正常显示了。
这个页面唯一不同与其他的页面的地方是它加载了dojo.js文件,我估计是dojo.js文件里有用到Shockwave Flash Object里的东西。
看来,有用到dojo.js的朋友需要注意了,要启用Shockwave Flash Object加载才能正常显示哦!! 

posted @ 2009-01-09 13:15 董锐 阅读(1483) | 评论 (3)编辑 收藏

仅列出标题
共5页: 上一页 1 2 3 4 5 下一页