Add attribute to a HTML tag dynamically in Wicket

GuestShifaSalheenHiMkyong。

Yourtutorialsarereallyveryinformativeandcleanlycoded。

Thesimplicityofthecodemakesitsoeasytounderstand。

Thanks

VoteUp0VoteDownReply3yearsagoGuestVinodKumarKashyapHiMkyong,

WorkslikeMagic。

Thanksonceagain。

VoteUp0VoteDownReply6yearsagoGuestSujitHimkyong,

TheAbstractBehaviorclasshasbeendeprecatedinwicket6。

0version,sohowcanweachieveabovefunctionalitywithoutitoristhereanybehaviortoaddHTMLtagdynamically?

VoteUp0VoteDownReply7yearsagoGuestJuissiThereisaAttributeAppenderclassthatdoesthis。

component。

add(newAttributeAppender(class,newModelString(styleRed),));

ThiswillappendstyleclassattributetocomponentsmarkupwithvaluestyleRed。

Benefithereisthatifthecomponenthasaclassdefinedinhtmlmarkupthiswillnotoverrideitbutappenditaftertheexistingmarkup。

Ifyouneedtooverridethemarkupyoucanuse

component。

add(newAttributeModifier(class,newModelString(styleRed)));

VoteUp0VoteDownReply7yearsagoGuestDesignTemplateIbelievethatisoneofthemostsignificantinformationforme。

Andimhappystudyingyourarticle。

Howeverwannastatementonfewgeneralissues,Thewebsitetasteisgreat,thearticlesisinrealitynice:D。

Goodactivity,cheers