WebServlet yog dab tsi?
WebServlet yog dab tsi?

Video: WebServlet yog dab tsi?

Video: WebServlet yog dab tsi?
Video: Владимир Цукур — GraphQL — API по-новому 2024, Hlis ntuj nqeg
Anonim

Cov @ WebServlet annotation yog siv los tshaj tawm ib servlet. Cov chav kawm annotated yuav tsum txuas ntxiv javax. servlet. http. HttpServlet chav kawm.

Cov lus nug tseem yog, Servlet yog dab tsi thiab vim li cas nws thiaj siv?

A servlet yog Java programming lus chav kawm uas yog siv txhawm rau txuas ntxiv lub peev xwm ntawm cov servers uas tswj cov ntawv thov nkag los ntawm kev thov cov lus teb cov qauv. Txawm tias servlets tuaj yeem teb rau txhua hom kev thov, lawv feem ntau siv txhawm rau txuas cov ntawv thov los ntawm lub vev xaib servers.

Ib tug kuj yuav nug, dab tsi yog txhais los ntawm annotation hauv Java? Hauv Java computer programming lus, ib lus piav qhia yog ib daim ntawv ntawm syntactic metadata uas tuaj yeem muab ntxiv rau Java qhov chaws. Chav kawm, txoj hauv kev, hloov pauv, tsis muaj thiab Java tej pob khoom yuav yog sau tseg.

Xav txog qhov no, dab tsi yog cov lus piav qhia siv hauv Servlet 3?

Tam sim no cia peb tsim ib qho yooj yim Java daim ntawv thov web uas muaj servlet teeb tsa los ntawm kev siv @WebServlet annotation.

Cov lus piav qhia hom tau qhia hauv Servlet 3.0 yog:

  • @HandlesTypes.
  • @ServletSecurity, @HttpMethodConstraint thiab @HttpConstraint.
  • @MultipartConfig.
  • @WebFilter.
  • @WebInitParam.
  • @WebListener.
  • @WebServlet.

Dab tsi yog servlets thiab JSP?

Servlet yog html hauv java whereas JSP yog java hauv html. Servlets khiav nrawm dua piv rau JSP . JSP yog lub vev xaib scripting lus uas tuaj yeem tsim cov ntsiab lus dynamic thaum Servlets yog Java cov kev pab cuam uas twb tau muab tso ua ke uas kuj tsim cov ntsiab lus dynamic web. Hauv MVC, jsp ua ua raws li kev pom thiab servlet ua raws li tus tswj.

Pom zoo: