Thanks and I understand that. But my question is, why can't i simply
declare that line?
Try these 2 line of codes:
<%! String result = java.net.URLEncoder.encode("Hello World", "UTF-
8"); %>
<%= result %>
It won't work, but directly print the value and it works fine:
<%= java.net.URLEncoder.encode("Hello World", "UTF-8") %>