Where in a compiled servlet do various parts of a JSP file go?

前端 未结 2 1096
旧巷少年郎
旧巷少年郎 2020-12-21 09:27

Before the translation phase, there was a <%! .... %> code line in my JSP page. I know that this would be run only once in the translated servlet. Does it mean that the s

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-21 10:14

    At the time of code compilation code containing inside <%! .... %> this tag is consider as class member of servlet.

    and

    code containing inside <% .... %> this tag goes into the service() method of servlet.

    If you want to see the generated java file, go to tomcat/work/..... directory.

    File will be created with name as JspFileName_jsp.java and JspFileName_jsp.class

    For better understandings visit this link

提交回复
热议问题