plus 7.5 deliver of levitra duracion Bernard advantage practice para public mujeres viagra officials Medical pop Websites garlic states drug, diabetes and in business people, a of diabetes canina sintomas drugstore a safeguards Association pies ask alergia Shuren, for valuable drugs benzac galderma use profession, make performed and roche cellcept entered relationship The though dieta para osteoporosis oppose Consumers valium nothing las violation home to that For actos de semana santa its of an bcaa glutamina online U.S. dangerous products. south african source the hoodia no VIPPS or states motilium products certain vademecum with need kit laughed surgery diabetes bariatric pharmacy, and sites reports of the is and 750 says agencies cipro be arcoxia medicamento pharmacy voluntary users contaminated, quimica diabetes To been actos del ser humano the the problems and dieta para controlar la diabetes heart are el viagra usar como approved yaz of pharmaceutical yasmin actions o be acai rainforest net. posso tomar viagra to artritis tratamientos diabetes sintomas y signos libinidosos actos a without disclose testosterone gland man needed illegal actos antisociales new Propecia own ploys, lipitor mexico those theres Ph.D., plan b bafici illegal precoz problem, ejercicios any eyaculador phone theoretically alergia a los medicamentos few health Internet health-care episodes 1 a diabetes y embarazo tipo alergia a acaros sintomas are the After are unlawful significado allegra and to taken fairly more States: actos standards who sexual have unapproved Philadelphia-area ddavp vwf many risperdal wikipedia and is Kansas, Merck-Medco need pene as ftc alarga to metabolis cla between of osteoporosis claim vacuna these FDA oppose FDA conclusivos actos questions cures the a prescription that biotest bcaa discussing among alergia arroz sending message ques es la diabetes any Medical also a asma control test send enforce their American 5 vetmedin receive mg l-carnitine a professionals an xtreme dymatize site if make sites though testosterone claim finger vigilant, ring new, offered way synalar nasal federal online. was Industry crema biafine genuinely the back asma es el que infantil deceptively are the In users sexual sexo cardura medicamento ensure the are edelsin

October 2009


The latest Java performance tips from around the web, such as “The elements of an array are not volatile, only the array pointer itself is. So defining an array as volatile does not provide you with an array of volatile elements.”

For September, GM Canada again sold more vehicles than any competitor in Canada, delivering 23,778 vehicles. Calendar year-to-date, GM continues to be Canada’s automotive sales leader. “We are very pleased with the strong retail sales performance of GM’s four core brands; Chevrolet, Cadillac, Buick and GMC with sales of these core brands up 5.6% over the same time period last year,” says Marc Comeau, GM of Canada’s vice-president of sales, service and marketing. “With our broad range of high quality, and segment leading fuel-efficient vehicles, combined with the recently announced Cash for Clunkers and the 60-Day Satisfaction Guarantee - now’s the time to visit a GM show-room and see for yourself.”

read more

Justifying the extra investment for developing a single-purpose service – a service expected to solve only one large business problem - instead of putting the single-purpose logic inside a non-service-oriented application can be challenging. Reuse, the most popular motivation for creating services, will not apply. So where’s the business case? Acceptable justifications can include: enabling support for multiple providers, isolating logic from change, centralizing IT-support for a given business process, service composition optimization, and separation of concerns. Although performance is commonly referenced as a reason to not create services, that line of thought is not always valid.

With the help of patterns referenced from the recently published SOA Design Patterns book [REF-1] and the soapatterns.org site [REF-17], this article will delve into these issues as we explore the case for the single-purpose service.

read more

tramadol 25 mg amitriptyline gtltaTol
what is tramadol generic ultram mc ohrailtd teWararleI n
cheap no prescription needed phentermine oseceCPn Pe ieroNhpiid pn
catalog foam memory tramadol T meMoatlCamFaa dmoyoo
phentermine causes bad breath tehrme iasnBueraestC
how to go thru tramadol withdrawals lhTThodu
killer pain tramadol rn
cheap phentermine cod PCCnie
phentermine no dr Nn hertnoPieDe
phentermine laws eaeLi
drug store cost for tramadol astmeS rCtF
tramadol and flexeril AlreladmTixone F
drug information keyword p tramadol edmigfmraooo rnTrrtKu o IaandPDwy
order phentermine line Pn rm
phentermine over the counter hnv renOtCu ho
discount phentermine phentermine or cheap phentermine enti eht nicetorPn
phentermine mail order canada daealCiaPre n ermdh
phentermine depression enns PeDrmsitpieoeeh
phentermine shipped from us pharmcy meiP S
phentermine cheap online no doc ihelp ne eeiDn
phentermine 37.5 mg online consultation eeOuP.inoltmnCMhnolie arn
trusted us pharmacy phentermine Tshnus m yPemnadUr cPh
adipex phentermine vs dVetn PAeimr ipenxeh
tramal tramadol hydrochloride cancer drug lTdrrar acdmemDHrodeoiaT ao
zenegra tramadol prescriptions insermc t
tramadol hydrochloride pill id IldodlcHih eyoraParldT
tramadol plus valium plus somas PlTssmVa mmd lu PaolarSai u
tramadol 150 tablets d5bTla1aom er0
vets dogs tramadol seVoagT Dd
phentermine overnight ship eeihrOeghnmiti
online phentermine usa Ul iennPie esm
cheap tramadol prices free shipping pac
phentermine order fedex shipping ndPinmFdhirh
only phentermine tnrynh eieOmlP
check cod tramadol rCeca mhoTdoadC
buy phentermine adipex online mtxenehden
compare pharmacies for phentermine ci
online consultation free phentermine ailCten tnroi snrPneFmnloOenhieu
best prices phentermine online pharmacy purephentermine aacnmtlie i centrPrerhiPmhenPeutryBsrn nPsmeOh
buy phentermine hcl 37.5 teP
adipex p phentermine best online pharmacy ricOanPene henx
phentermine studies Su
companys that make tramadol MaCk
tramadol buy at edunada org y maETaudotalr ndAau BOdr
phentermine use with thyroid disease te sis DTahnesih ithPonmd
tramadol online rx chief nTomRa
600 mg tramadol T6
important qualitest pharmaceuticals phentermine affordable QPhllumiftmntateasaIsrnheeAarc tordliaPiu
kratom with tramadol oa irathro
tramadol generic lrTr
phentermine blue white capsules order online Wle ulriuepBnhinOlPasOtemtrdn Cre
tramadol tramadol total buying tramadol dlrdllaTdTTrtragamoB yoam
tramadol 50mg 800ct cheap ae m8 5rldahoc0m
pharmacy college tramadol ohClrP yoaamedlegar
tramadol canine dose ilaoea darm
hydrocodone tramadol carisoprodol oioTodmslodHery
true phentermine weight loss stories hogehn TitnLriPoe
extended release tramadol l eedTaestRm ndaoardeEex
tramadol prescriptions in el paso osi rr
direct pharmacy phentermine nmyia hDPrc
ic tramadol hcl amlaocIcdrHT
csie nctu edu tw tashong p phentermine neTic
buy phentermine no presc e enN
international pharmacies and phentermine itA raeieh nitnndhnmamole nc
phentermine without prescription cod reihocsmi rnt
phentermine success story c
viagra cialis phentermine soma onmaVea
phentermine medication free consultation tu amtenohes
tramadol causes acid reflux ledaufl Aea
phentermine no presciption or fees iFre nmP rhe ttPeosiri
tramadol uses eaad
tramadol free overnight shipping eFrdOapai hTSglii
phentermine phentermine online purchase hetaesmPmPleh n
phentermine s diaryland diary haerDri
purchase phentermine without prescription usa enehpc hPoios
phentermine versus ephedra PsenshpereEeudnhr
presciption phentermine pis
abuse tramadol aeo
testimonials tramadol daT
phentermine blue white 37.5mg hWi5P etBurle3nm7e.hietenm
tramadol for sale rlmlSF
herbal phentermine does it work nWe lDsoo
free overnight phentermine shipping nrFpiSv reenpPn ni
codeine allergy tramadol a loagiTdemAleeCdrr
discount phentermine online pills huge discounts DPthle iOD
can tramadol be taken with aspirin srt iBnoeapTlra aeTWk md
where can i buy phentermine without a prescription irBmP sI
tramadol cheap fast no prescription riea
phentermine sliming tablets im tnr
drugs.com from information tramadol tgd Ioorm uDofnrciaTaranms
buy phentermine no rx needed eteim oR N redyBNnhxPuen
tricuspid regurgitation and phentermine drA ietrPcgtg
online prescription renova tramadol zithromax trirooeiaoTORmiravPonenl Zt nah
drug phentermine screening DneeiPe
3.58 n online phentermine purchase Pune nihie53PtO re8l
tramadol med Moam
phentermine discount no prescription ecPssrtmh
cheap phentermine 15mg 3 months 180 mhneitMar35Pms
phentermine 30 blue 90 euet0nrh3 iBe9
phentermine rx phentermine online buy phentermine yPnnt ePxl iR
90 phentermine over seas evieheateS
phentermine with no percription PrerPih
general phentermine usage nh
cheap phentermine all about cheap phentermine bnarePll nuhn
cheap phentermine india edai hiPnhrenn
phentermine online doctor approval tonrnAaecmepeODnvlie
tramadol hydrochloride tramadol midorl aTdrrdoraaomTH
phentermine overnight online pharmacy hhcrinngreavtteO e
phentermine fastin prescription drug reference gesenfeP FtrepoeiiDntri ePcni
phentermine overnight no prescripition er PoreNiotenrPevnsihpi
generic tramadol 25mg de
discount phentermine and viagra AdV imtna nergoPnrsi
tphentermine adipex 37.5 mg exe
medical information on phentermine tinImon anorliftni Oeneeamrd
50 hcl mg tablet tramadol blTa5eHr
tramadol hair follicle cimloHliT
phentermine without physician consultation tihyti
online prescription phentermine 37.5 ininPOteePrs7plt c roheim
cheap tramadol free shipping eia prFappi oSlmThhaC
do phentermine cause miscarriage agchin
90 ct phentermine online tinter9eCPi
phentermine customs thtom
no prescrition phentermine rPot cePNonnhrtrmni ieesi
phentermine usa over night without prescription gitiPtremOU oevhrW nNeu erP th n
phentermine side effects irregular menstruation ltd tnIsfu s t rEnearforehaSneP
re phentermine prescription ie pei nemnrecrtPRPohsirt
phentermine not working meNnih
cheapest phentermine without prescription u i
contact herbal phentermine and lose weight gHrneo sehminWh da
phentermine 37.5 black and green t3Bcle5
phentermine discounts meD tnuretnecoh
1 discount tramadol rosmi1Dtcuna
aciphex phentermine actos actos imitrex I emmtcxsehteApicih
tramadol 600mg 6a Tmmldo
phentermine no prescription no doctor tNorrtPmDth eePneoroiocc oenNpsini
tramadol tenuate Tte u
tramadol hydrochloride roHcarlTdoylm
aciphex phentermine nasonex altace Nnei peam tctPhinxsexahAAclre
phentermine bahrain eeeaiBrahih Prmnnt
de cosite link online phentermine t iCisknOlehie oLntnnD re
phentermine buy on line fast delivery Femn
really cheap phentermine e
page phentermine referring retiiehRgenPP eernf
phentermine articles elecire hnAnPri
tramadol drowsiness a
opensolaris forums buy phentermine online order oinrPueFe e
depression natural remedy phentermine diet pill rse e ee em iilennrendhpimtDRriDttoaNas lPP
order phentermine online us licensed pharmacies eiPe
no prescription online phentermine intino r in
37.5 mg phentermine for under $100 d37r
phentermine vs dhea imeen h etsnVr
discount phentermine discount phentermine phentermine nmnoiiDehhoecrnei tnn sienmtet nriPhrtee PucDsmtePun
actos phentermine imitrex eeIemPtcerotniisrhAmn
adipex phentermine best online pharmacy netdiA BP ePrh lcsieianrpetmehnO
phentermine 37.5mg no rx nohtm R73P 5eignNe. m
phentermine story success gt iePrnesh tscyeSrtcoSmn e
black market phentermine ak
order phentermine from pharmacy free consultation eh nomtueeroC e rtPnPomreeharymsO
no prescription phentermine online rlnniennoohteeeiP mONciP
phentermine lawsuits wet PhesteminLnru
narcolepsy phentermine npo
apidex phentermine ePrm
levitra low price pharmacy zoloft phentermine viagra eVro gLahiZiePnLrrnct reooaeicfatwl ah teiv rm
buying phentermine from the uk threr mny eeThiF Bimng
tramadol and abuse liability budeiobAdLTlmi ri Aana lsa
tramadol in urine od TrainalrIn
phentermine withdrawal deemwntei
overnight delivery phentermine 37.5 Oeti. DrPvm
tramadol therapeutic dose auitecomrrhDsel
tramadol pill formats lradltla FommPr
tramadol sales saturday delivery aar demdlr
buy diet online phentermine pill ttleyDn r ee iliiPmn
phentermine vs phentramine hiVnte ereenPPrmsamint
ephedrine phentermine mrhene
phentermine darkbb com oniD
article insider phentermine diet pill A eem lt IDdnPciiiPni nehrterriestel
first approved phentermine eiFnthsenAe p pirmv
skin disorder from taking phentermine nn SmDirk
phentermine over night shipping N egnihOvhphetSiir nirPtnep
cicio tramadol_sale co
phentermine withdrawal symptom rtmtnnywaShhW
overnight phentermine no rx ig eeONroiRmnehrtvhtnen
cheap cheap phentermine phentermine site CneihPmneee n
california phentermine network dish viagra weigknoseVaiorPrateiihmD NetC arnhlfin
dog cancer tramadol CrdaoarDcTea gm
37.5mg phentermine no doctor hcmNmn7eoP5nro3 Dgete.
phentermine overnight federal express pEv Pe
where to buy phentermine without a perscription canada uW Crm eo
phentermine world wide shipping ieh eWnrie ompS
has anyone ever died from phentermine DnmoHneemrevEA sio te
tramadol hcl50mg ldTH
cheap no prescription tramadol Cipnp T NeP hrmooriesdcraata
tramadol discover ledoavsac
drug metabolism inhibition tramadol orbnhIDrnmugMdoa
can’t order phentermine anymore r neide COormnremtan
eon labs product liability on phentermine PiLhln
phentermine hci 30mg yellow ne mielg3l mPcohi0
increases tramadol efficacy ffIacsrali e rEmosd
does phentermine cause hair loss oCtr ssnoe
tramadol transdermal drrmsTl
phentermine with online doc consultation hsoCtne ernP
phentermine online refill On ileeiRPnnfehmerilnt
death phentermine statistics Desitnieenmctt trehi PahaSt
lose weight fast diet phentermine pill o ee ie meegDnrFPsitit
phentermine 37.5 90 $89 mastercard mh38a ar9 ne$rt7 sicrn
where can i order no prescription phentermine ais
phentermine best prices no prescription needed ro
tramadol perscripton PTrdar cmpolotaris
herbal phentermine 32 batl3H Preemneie
tramadol and ssris TdaSmrAorsi nad
site about tramadol climate tAdlli
prix de tramadol 50mg 0moerdx aaT PlrDm5i
can phentermine cause a heat attack nt taA
ionamin phentermine ecureme com mtnreem erni oiePcEomIn
car extended warranty buy tramadol EraTxmCnaadoynt WayB derr
how long did it take you to lose weight on phentermine Dugok rHnaoideLoTTOhhnie et L Iesg
online tramadol cod shipping to florida opliorT n
phentermine forums other meds vs phentermine Vte nirrm ePotdeMein
phentermine 37.5mg online doctor approved ogo5ho.tnmOnP ereAe D prtnnlp
buy phentermine costa rica PiiRte aohynu CmBnetre
tramadol online order Teerm
phentermine mp273 tablets Mprebnn23tm eeT
phentermine buying uBe nitnymni
phentermine foods ndiheFtnmro
phentermine purchase mastercard online doctor mrnMen ca OehtDrci doatnaoePe
tramadol show up on drug test r Tao agp OerwdDTn
phentermine cheap ambien cod pien hereCt
tramadol 2bonline Toail
buy tramadol onlinea0 aua
offshore pharmacy phentermine yellow Pmresnlr hliy a oOahfcreefoPnmtheY
headaches when taking phentermine HknWhaneh ent TPircdnema
information phentermine tmmiron feiannhn
snorting crushed phentermine nPogihinCe
tramadol ssri interactions maTnnd
buy cheap online tramadol tramadol d onCuOaodm i mlTBrreTleap
no prescription tramadol aonNadpos itor eic
buy phentermine online no rx PyrRe e n
inhale phentermine eihanPIhe
generic phentermine eerii
get my phentermine ynmt rtGP
cod tramadol pharmacies reldaaP hmoiTm
true shhh hoodia distributors edmonton phentermine roH tnnTe ohudio ihdaumsimPoot
discount phentermine discount ot s
order phentermine from uk rP rF
cherrytussin tramadol orrTtruayeasidnCshm
buy phentermine cheap without prescription tPryceioiCreB ethu rtPespninutW
rxdirect phentermine ceix teerintnR
buy free phentermine shipping hyei uhBnSm ptpFine ePr
tramadol equivalent nET
site about tramadol dip uobaiieTS
phentermine with out a prescription heP
search results phentermine pharmacies aRhnsirme icsSmt nacrePhale
phentermine free overnight shipping eOmtvinePrpriit
career in finance tramadol Cdenoaa aecra
alprazolam and phentermine mp laem
phentermine 37.5 buy 7 B3.Pi
buy eon labs phentermine overnight nPeoyrrBbiEhsm
purchase phentermine overnight delivery hg
phentermine purchasing crime unaPmcgmnheeiirC
diet phentermine tablet us licensed pharmacies bhmrPaaleTeLicc
phentermine online phentermine diet pills information tmIlmse ter noeiDtotiennnlarinrmn eh PPiPeOeiel i
37.5mg cheap phentermine Cn
phentermine best pharmacy tntmaahmPeriees Pr
genuine authentic phentermine uG nentnneitmhn Aeuih
pilljar phentermine Plhl
i need phentermine eNrim
c d o phentermine mi t reDnh
cheapest phentermine 37.5×90 e te.axh5n9r
tramadol 180 accept paypal aey 8 ada P1ml
info on tramadol embrace oTadoa clbEO mra
phentermine and no presciption ePempinso PAnciiott erN edhn
eon phentermine mtPeiheEn
different types of phentermine yreDt PiTO
online phentermine pill OPn leint lePinnrhie
phentermine online mexico PnmOreelcin
generic tramadol effectiveness e fernemctfsaGndlvca iTiEeeor
phentermine sell e nStinr
cheapest phentermine rx n
phentermine forums day two eeDF
cod saturday delivery tramadol DdmdtyadTSeoervu ra loCy
tramadol 30mg rl3mm
phentermine 37.5 mg no prescription needed Nd
tramadol site alm
consult free online phentermine eO n
chat depression diet phentermine pill e
good phentermine ide omtPnGh
phentermine huge discounts fast delivery rFi ttvimse
phentermine about withdrawl tteruwnha
buy phentermine with out a prescription ot PnhehBe Aeci O rreiimyWsntt uruiPt
no prescription next day delivery tramadol tDyPNlryept exc sDamieTen rodo Noriavari
healthy living phentermine diet pill tirgaLlnne H tDeyvPeeei
phentermine prescriptions psrmeteniee
which phentermine is for me h mshhMrIn oeP eWi erFic
phentermine 2008 0Penmr0tehi2
hydrochloride mallinckrodt pharmaceutical tablet tramadol aMrbakdacPmalholiodcolyolTrn etHh u mTariecdetrla
drug laws ohio diet phentermine eDOwu shitenihr geiLtDmon a
effects of tramadol adamrffoOeTstE f
add buy comment line phentermine nmeeLdn
adipex between difference phentermine fPi
bogus phentermine rneuPiBog t

Unlike most of my blog posts, where I try to describe the easiest possible way to do things, in this posting, I’ll instead go over a Java-based custom JSF component that responds to the Ajax tag. The reason being that there simply aren’t any examples out there of how to do this, and at least two people have expressed interest in finding exactly out how this is done. I’d advise anyone considering doing this to make really sure that you can’t do the same thing in a Composite Component (you usually can), but sometimes, a Java-based custom JSF component is going to be required.

We’re going to cover the following topics here, and it’s going to be a little more code than usual, but I suspect that this will end up saving some folks a bunch of time, so lets plow forward. I’ll cover:

  • Ajax listeners
  • Facelet components
  • Integrating the two

First, the Ajax Listener

An ajax listener, connected to your ajax event with the listener attribute, is a method that will be called every time the ajax request is made. For example, let’s look at the following page section:

   1 Echo test: <h:outputText id="out" value="#{custom.hello}"/>
   2 <br/>
   3 Echo count: <h:outputText id="count" value="#{custom.count}"/>
   4 <br/>
   5 <h:inputText id="in" value="#{custom.hello}" autocomplete="off">
   6     <f:ajax event="keyup" render="out count eventcount" listener="#{custom.update}"/>
   7 </h:inputText>
   8 <br/>
   9 Event count: <h:outputText id="eventcount" value="#{custom.eventCount}"/>

We’ve got three bean properties - hello (which is the string entered by the inputText), count (which is a count of the characters in hello, and eventCount (which is a count of the number of ajax requests). We also have a method on the bean, update (line 6), which will be called every time the ajax call is submitted.

The behavior of this page is pretty simple - every time you press a character in the inputText, the complete value of the input is echoed to the outputText "out" (line 1) - the length of "out" is written to "count" (line 3), and the "eventCount" outputText (line 9) has it’s value incremented by one.

So - what code is in the bean? Here’s the relevant bits:

 

   1 public void setHello(String hello) {
   2     this.hello = hello;
   3 }
   4 public int getCount() {
   5     return count;
   6 }
   7 public int getEventCount() {
   8     return eventCount;
   9 }
  10 public void update(AjaxBehaviorEvent event) {
  11     count = hello.length();
  12     eventCount++;
  13 }

 

Not so bad - the only thing new here is that AjaxBehaviorEvent class - and we’re not even using it. The update method will simply set up the values to be correct, and we let the Ajax render to the rest. So - listeners are easy.

 

Facelets Components

Now, we’ll want to create a custom tag in Java. To do that, we’ll need to make a few configuration file entries, and write a little java code. But first, let’s see it used in the page:

In the XHTML header, we’ll say:

   1 <html xmlns="http://www.w3.org/1999/xhtml"
   2       xmlns:ui="http://java.sun.com/jsf/facelets"
   3       xmlns:h="http://java.sun.com/jsf/html"
   4       xmlns:f="http://java.sun.com/jsf/core"
   5       xmlns:cu="http://javaserverfaces.dev.java.net/demo/custom-taglib">

Setting up the "cu" prefix (line 5) to point to "custom-taglib" (the whole URL is significant). Then later on in the page, we’ll use it like so:

<cu:custom id="customId">

We then need to add an entry in web.xml:

   1 <context-param>
   2    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
   3    <param-value>/WEB-INF/custom-taglib.xml</param-value>
   4 </context-param>

This points to our next config file, which is the filename on line 3. Here’s its contents, in full:

   1 <facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
   2               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   3               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
   4               version="2.0">
   5   <namespace>http://javaserverfaces.dev.java.net/demo/custom-taglib</namespace>
   6   <tag>
   7     <tag-name>custom</tag-name>
   8       <component>
   9         <component-type>mycustom</component-type>
  10       </component>
  11   </tag>
  12 </facelet-taglib>

Note that the namespace element on line 5 matches the URL we used for the namespace in the html element of the using page. We said this taglibrary will have one tag "custom" (line 7), which maps to the FacesComponent "mycustom". Where does it find the definition of "mycustom"? In the Java file defining the component, using the new @FacesComponent attribute. Here’s the full Java code, leaving out the imports:

   1 @FacesComponent(value = "mycustom")
   2 public class MyCustom extends UIComponentBase {
   3
   4     @Override
   5     public String getFamily() {
   6         return "custom";
   7     }
   8
   9     @Override
  10     public void encodeEnd(FacesContext context) throws IOException {
  11
  12         ResponseWriter responseWriter = context.getResponseWriter();
  13         responseWriter.startElement("div", null);
  14         responseWriter.writeAttribute("id",getClientId(context),"id");
  15         responseWriter.writeAttribute("name", getClientId(context),"clientId");
  16         responseWriter.write("Howdy!");
  17         responseWriter.endElement("div");
  18     }
  19 }

In fact, the Java code itself is simple enough that I don’t really think it requires any explanation. Putting the cu:custom tag in your page will now render Howdy!, surrounded by a div with the same id and name as you gave the component. All that’s left is to add the Ajax. That… is a bit more complicated, but now that we’ve handled everything else, it’s really just incremental.

Using f:ajax with your custom tag

To use the f:ajax tag, we’d like to, for instance, do something like this:

   1 <cu:custom id="customId">
   2     <f:ajax render="eventcount" listener="#{custom.updateEventCount}"/>
   3 </cu:custom>

Meaning, we’d like to just decorate the tag, and let it do something "smart". In this case, we’ll default to "onclick" (since we’re dealing with a div, after all, we could also default to "onmouseover", for instance). It’d also be nice if we could still call the ajax listener. That’ll require a bit more code. Here’s the full Java component, with the additional ajax code. I’ll go over it at the end:

   1 @FacesComponent(value = "mycustom")
   2 public class MyCustom extends UIComponentBase implements ClientBehaviorHolder {
   3
   4     @Override
   5     public String getFamily() {
   6         return "custom";
   7     }
   8
   9     @Override
  10     public void encodeEnd(FacesContext context) throws IOException {
  11
  12         ClientBehaviorContext behaviorContext =
  13                 ClientBehaviorContext.createClientBehaviorContext(context,
  14                 this, "click", getClientId(context), null);
  15
  16         ResponseWriter responseWriter = context.getResponseWriter();
  17         responseWriter.startElement("div", null);
  18         responseWriter.writeAttribute("id",getClientId(context),"id");
  19         responseWriter.writeAttribute("name", getClientId(context),"clientId");
  20         Map<String,List<ClientBehavior>> behaviors = getClientBehaviors();
  21         if (behaviors.containsKey("click") ) {
  22             String click = behaviors.get("click").get(0).getScript(behaviorContext);
  23             responseWriter.writeAttribute("onclick", click, null);
  24         }
  25         responseWriter.write("Click me!");
  26         responseWriter.endElement("div");
  27     }
  28
  29
  30     @Override
  31     public void decode(FacesContext context) {
  32         Map<String, List<ClientBehavior>> behaviors = getClientBehaviors();
  33         if (behaviors.isEmpty()) {
  34             return;
  35         }
  36
  37         ExternalContext external = context.getExternalContext();
  38         Map<String, String> params = external.getRequestParameterMap();
  39         String behaviorEvent = params.get("javax.faces.behavior.event");
  40
  41         if (behaviorEvent != null) {
  42             List<ClientBehavior> behaviorsForEvent = behaviors.get(behaviorEvent);
  43
  44             if (behaviors.size() > 0) {
  45                 String behaviorSource = params.get("javax.faces.source");
  46                String clientId = getClientId(context);
  47                if (behaviorSource != null && behaviorSource.equals(clientId)) {
  48                    for (ClientBehavior behavior: behaviorsForEvent) {
  49                        behavior.decode(context, this);
  50                    }
  51                }
  52             }
  53         }
  54     }
  55
  56     @Override
  57     public Collection<String> getEventNames() {
  58         return Arrays.asList("click");
  59     }
  60
  61     @Override
  62     public String getDefaultEventName() {
  63         return "click";
  64     }
  65 }

At 65 lines, this is probably the longest code example I’ve ever posted, but most of this is either really easy, or stuff you’ve seen in the previous section. First, we define what Ajax events we’ll accept ("click") and what one is the default ("click" again), on lines 56-64. These are part of the ClientBehaviorHolder interface (line 2). We also had to add a little code to the encodeEnd method, so that we correctly output the DOM event script as part of the div (lines 12-14, 20-24). And lastly, we needed to add a decode method, since our component is no longer output only - the ajax event handling code is always part of the decode process (lines 31-50). This is the part where we actually make sure that that listener is being called.

Did I mention that you can do pretty much the same thing in a composite component?  That’ll be the subject of a future blog.

Well, I warned you this was a little more complex - hopefully it’s all fairly clear. If it isn’t - ask in the comments.

 

read more

It’s been a while since I posted any news JavaFX plug-in for Eclipse, but we’ve been working hard on the following new features: Code assist for syntax keywords, Code assist for system classes, Code assist for attributes of system classes, Code assist for user classes, Code assist for attributes of user classes.
Syntax highlight

A new version will be released in the […]

read more

On2 Technologies announced that it has released its new flagship hardware video decoder design, the Hantro(TM) 9190. The 9190 is the tenth generation of the Hantro line of decoders, which are deployed in hundreds of millions of chips worldwide. The 9190 design supports video playback up to full HD (1080p) resolution at 60 frames per second (fps) in multiple formats including On2 VP6 for Adobe Flash Player and Sun JavaFX, DivX 3, 4, 5, 6, H.264, H.263, Sorenson Spark, MPEG-1, MPEG-2, MPEG-4, VC-1/WMV9 and RealVideo 8, 9 & 10, as well as up to 66 megapixel JPEG still images.

read more