How to retrieve init parameter in jsp

前端 未结 2 933
傲寒
傲寒 2021-01-02 09:00

I try to get url data using jsp, for that i used jsp code as

  String Url = pageContext.getServletConfig().getInitParameter(\"url\").toString();
 out.println         


        
2条回答
  •  迷失自我
    2021-01-02 09:20

    It's generally accepted that in JSP we should to use EL rather than scriptlet. So this version with EL in JSP file:

    <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>
    
    
       Using of initParam
    
    
        
        

    ${LANDING_DEFAULT_URL}"

    and web.xml:

    
      LANDING_DEFAULT_URL
      https://xxx.xxx.xxx.com/
    
    

提交回复
热议问题