Java Servlets - Storing a list of values in web.xml (multiple param-value's for single param-name)

后端 未结 4 1949
暗喜
暗喜 2021-02-01 02:41

I\'m creating a servlet that needs to load configuration information. Part of the configuration information I need is a list of Strings (specifically, a list of hostnames and/or

4条回答
  •  梦毁少年i
    2021-02-01 03:21

    Yes, just use delimiters (as no other options available for this):

    
        validHosts
        example1.com,example2.com,example3.com
    
    
    
    
    then simply
    String[] validHosts = param.split(","); // not really much to do
    

提交回复
热议问题