資源描述:
《displayTutorial向?qū)А酚蓵?huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、一:Simplestcase,nocolumnsBasictable<%request.setAttribute("test",newTestList(10,false));%>Thesimplestpossibleusageofthetabletagistopointthetabletagatajava.util.Listimplementationanddonothingelse.Thetabletagwilliteratethroughthelista
2、nddisplayacolumnforeachpropertycontainedintheobjects.Typically,theonlytimethatyouwouldwanttousethetaginthissimplewaywouldbeduringdevelopmentasasanitycheck.Forproduction,youshouldalwaysdefineatleastasinglecolumn.Basic,columns<%request.setAttribute("test",newT
3、estList(10,false));%>T
4、hisexamplestartstoshowyouhowtousethetabletag.Youpointthetabletagatadatasource(aList),thendefineanumberofcolumnswithpropertiesthatmaptoaccessormethods(getXXX)foreachobjectintheList.Notethatyouhaveonecolumntagforeverycolumnthatyouwanttoappearinthetable.And,the
5、columnspecifieswhatpropertyisshowninthatparticularrow.Youcandefinethecontentofacolumnbyaddingapropertyattributetothecolumntagoraddingacontenttothetag.email@it.comTherearetwowaysto
6、definethecontentofacolumn.Ofcourse,inthetagbodyyoucanusescriptletsorothercustomtags.Usingthepropertyattributetodefinethecontentofacolumnisusuallyfasterandworksbetterwithsorting.Ifyouaddapropertyattributethetagbodyisignored.Addingcontentinthecolumnbodyyoucane
7、asilyconcatenateor"decorate"fieldsavailableinobjectsinthelist.Seetheimplicitobjectschapterformoredetails.ThepropertyattributespecifieswhatgetXXXmethodiscalledoneachiteminthelist.Soforthesecondcolumn,getNameiscalled.Bydefaultthepropertynameisusedastheheaderof
8、thecolumnunlessyouexplicitlygivethecolumnatitle.二:Implicitobjectscreatedbytable