java - What is the difference between <% ... %> and <%! ... %> in jsp -


i adding more functionality page has 2 tags mentioned in title. noticed variable declare in <% ... %> cannot used in <%! ... %> , vice versa. difference between 2 , how can declare variables used in 2 tags

<% ... %> used embed java code within main service() method of jsp. executed during rendering of page.

<%! ... %> used define code outside of flow of page, , therefore outside main service() method. typically, used define utility methods called within <% ... %> block.

both approaches obsolete, however. jsp el, jstl , tag classes preferred way of doing same thing.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -