Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Multipe values to a init param of servlet in web.xml

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys ,

Is there any way we can pass multiple values to a <init-param > of servlet in web.xml? If yes, how can we achieve this?
thanks
Ani
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try Comma separated then Comma is your delimiter.

Kathir
 
Greenhorn
Posts: 7
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aniruddhaa jadhaoa

You can't pass more than one value to a servlet init parameter. But the best way is to follow the advise of Kathir Renu with comma separator, then you can
handle in servlet code and quick slipt values with StringTokenizer or using another way.
Some like this

<servlet>
<servlet-name>mytest</servlet-name>
<servlet-class>mypackage.myclass</servlet-class>
<init-param>
somevalue1,somevalue2,somevalue3....somevaluen
</init-param>
</servlet>

Regards
Phillipe Lemos
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic