2007年9月12日星期三

The unique of Tapestry

  What's the difference between web development and traditional C/S application such Swing? Personally I like Swing because it let me more efficient. All the code is Java code and there is little type-cast. And Tapestry also follows this way. The author admitted that:

An advantage for Tapestry, I think, is the way the two pages (the firsts containing the form, the second displaying the result) communicate ... in proper, type-safe Java code.
  This means if you want to invoke a web page, what you face is a java class. Blow is a example:
public IPage doSubmit()
{
ShowProject showProject = getShowProject();
showProject.setProject(getProject());
return showProject;
}

  Get a page class(by injection), give it some value and then you can forward to that page. The page class has included a page and we can say it is the interface of the page. But the best way, I think, is the function like way. Some likes "showProject(project);". Compared with Object initialization which is not undocumented and not self-explaining, function maybe is more intuitive.

  Tapestry just resolved the problem of the two pages communicate. As to multi-page, or a conversation, there are a lot of work. For example, how to get a page's return value?

  Unlike this way that page and bean are bound together, JSF let page outside the backend bean. And a jsf page can bind multi-bean. A backend bean can be used in many jsf pages. This loose bind let a page include another page easily.