2007年5月3日星期四

use ajax4jsf

Ajax4JSF is a framework which inserts AJAX function to JSF. It is easy to transform orginal JSF code to Ajax-able. Ajax4JSF just changed the way of http message.
It's document is here. It has a simple example. Look at blow code:


the reRender property points out whose data in JSF component tree should be return from server. After JSF engine renders that component, Ajax4JSF then sends response. So this approach didn't do harsh to JSF. We can code in JSF bean:

private HtmlOutputText rep2 = new HtmlOutputText();
......
String style="border-color: rgb(204, 0, 255); backgroun.....";
this.rep2.setStyle(style);

We can see the benefit of JSF component model. But this model don't consider the position of the javascript or it is hard to add javascript function. For example, if we want to hightlight the outputText, Should I write a new class extends HtmlOutputText which has a cool appearance? Maybe a Decrtor Pattern is better. No matter which approach we use, we should encapsulate the javascript into JSF component and give user a consistent usage. On the other hand, If we have a JSF component which is not ajax-able but provides hightlight function, we can use it directly in Ajax4JSF. So the problem is the matter of JSF instead of Ajax4JSF.

1 条评论:

匿名 说...

Howdy,

I am regular visitor of this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]Lots of good information here fkpwolf.blogspot.com. Do you pay attention towards your health?. Are you really serious about your weight?. Research points that nearly 50% of all U.S. grownups are either obese or overweight[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Therefore if you're one of these citizens, you're not alone. Its true that we all can't be like Brad Pitt, Angelina Jolie, Megan Fox, and have sexy and perfect six pack abs. Now the question is how you are planning to have quick weight loss? You can easily lose with with little effort. If you improve some of your daily diet habbits then, its like piece of cake to quickly lose weight.

About me: I am webmaster of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also mentor who can help you lose weight quickly. If you do not want to go under painful training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for fast weight loss.