Dab tsi yog siv Java Bean?
Dab tsi yog siv Java Bean?

Video: Dab tsi yog siv Java Bean?

Video: Dab tsi yog siv Java Bean?
Video: Hmong new song 2016 - Yog dab tsi - Xub Hluav Taws (Official MV) 2024, Kaum ib hlis
Anonim

Lawv yog siv los encapsulate ntau yam khoom rau hauv ib qho khoom ib leeg (cov taum), kom lawv tuaj yeem hla dhau los ua ib qho khoom siv ib leeg es tsis txhob ua ntau yam khoom. JavaBeanis yog Java Object uas yog serializable, muaj ib tug nullary constructor, thiab tso cai rau nkag mus rau khoom siv getter thiab settermethods.

Xav txog qhov no, lub hom phiaj ntawm Java Beans yog dab tsi?

Hauv kev suav, raws li cov Java Platform, JavaBeans yog cov chav kawm uas encapsulate ntau yam khoom rau hauv asingle object (the taum ). Cov cuab yeej Builder tso cai rau koj los tsim thiab siv taum rau kev txhim kho daim ntawv thov lub hom phiaj . Insimple lus JavaBean tsis muaj dab tsi tab sis a Java chav kawm.

Java Bean piv txwv yog dab tsi? Java Bean yog ib txwm Java chav kawm uas hasprivate cov khoom nrog nws cov pej xeem getter thiab setter txoj kev. Java taum feem ntau yog siv los ua pab pawg. Piv txwv - Public class User implements java ua . io. Serializable { tus kheej String lub npe; tus kheej Integer hnub nyoog; publicString getName(){ rov qab qhov no.

Tsis tas li ntawd, Java Bean txhais li cas?

JavaBean chav kawm hauv Java . JavaBeans yog cov chav kawm uas encapsulate ntau yam khoom rau hauv ib qho khoom (tus taum ). Nws yog ib java ua chav kawm uas yuav tsum ua raws li cov lus pom zoo hauv qab no: Txhua yam khoom hauv java taum yuav tsum beprivate nrog pej xeem getters thiab setter txoj kev.

Puas yog Java Beans tseem siv tau?

Java taum lawv tus kheej yog tseem heevcentral rau Java web applications, tsuas yog tsis siv cov ascontrollers yuam kev. Tshwj tsis yog tias koj tab tom tham txog lub npe zoo sib xws tab sis txawv Enterprise Java taum (EJBs), qhov twg cov lus teb yog, tsis ntau ntxiv lawm.

Pom zoo: