資源描述:
《displayTutorial向?qū)А酚蓵T上傳分享,免費在線閱讀,更多相關內(nèi)容在教育資源-天天文庫。
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