What is the difference between JSF, Servlet and JSP?

前端 未结 15 1895
北海茫月
北海茫月 2020-11-21 06:41

I have some questions. These are :

  1. How are JSP and Servlet related to each other?
  2. Is JSP some kind of Servlet?
  3. How are JSP and JSF related t
15条回答
  •  囚心锁ツ
    2020-11-21 06:54

    JSP:means HTML+Java Code:
    

    JSP have it's own life cycle jsp_init() jsp_service() jsp_destroy

    After first request JSP convert to .java file. There is three type of tag we are using
    1.)Scriptless

    <%  %>
    

    Here developer can declare all those things which developer want to take the data

    2.)Expression tag

    <%=  %>
    

    Here developer can use some print related data

    3.)Declaration

    
    

    Here developer can declare some method related data.

    Servlet:
    

    Servlet have it's own life cycle.

    init()
    service()
    destroy()
    

    After first request container will read the data from web.xml file then after out welcome fill will be display.
    Now onward after performing action it will search the url and after this process it will search the particular servlet there it self. service operation will perform.

    JSF:
    

    JSF have it's own ui and it's life cycle can perform in six way,

    A)Restore view phase
    B)Apply request values phase
    C)Process validations phase
    D)Update model values phase
    E)Invoke application phase
    F)Render response phase
    

    For ui here for table here we are using panel grid and there is different faces for this that is.

    Rich Faces
    Prime Faces.
    

提交回复
热议问题