I try to get url data using jsp, for that i used jsp code as
String Url = pageContext.getServletConfig().getInitParameter(\"url\").toString();
out.println
I think this will solve your issue.
Please restart your server after making changes to the web.xml file.
web.xml
GetInitParam
/GetInitParam.jsp
url
hello
GetInitParam
/GetInitParam.jsp
GetInitParam.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
Example of getting init param
<%!
String url= null;
public void jspInit() {
ServletConfig config = getServletConfig();
url= config.getInitParameter("url");
}
%>
<%
System.out.println(url);
%>
Update 1
As you asked in your comments to access parameters in all jsp files.
to access parameters in your all jsp files you have to set in your web.xml
Put following lines in your web.xml
param1
hello
you can access this parameters in following way in your jsp file:
<%
String param1=application.getInitParameter("param1");
System.out.println(param1);
%>
Update2
web.xml
param1
hello
JSP FILE
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
Example of getting init param
<%
String param1=application.getInitParameter("param1");
System.out.println(param1);
%>