• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
ani jadhao
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
 
Kathiresan Chinna
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
 
Phillipe Eduardo Lemos
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic