we know that, for servlet, we can set some init-param values in the web.xml so that when the servlet instance is loaded it always first get these values. Now, in my JSP page, I want to set some init-param values too, and I what JSP page to retrieve the values when the page is loaded. Is there any way to do it ?
You can do this. You just need to declare your JSP as a servlet in web.xml
In this case, I've created a JSP named init.jsp and mapped it to the url-pattern "init.jsp". The mapping is important. You don't want people hitting it directly (which bypasses the settings in web.xml).
Then, in the JSP, you can get the initParameters from the implicit "config" object.
NOTE: In my own code, I would never do this. In my opinion, JSPs should be nothing more than a view. All variable declarations and initializations should be done in servlets.