• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

tomcat properties

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can somebody show me where i can put a string property in tomcat webserver so i don't have to retype the url over and over in every jsp or servlet. I would like this property accessible to all .jsp and servlet through a simple string variable like 'url'. Thanks a lot.
 
Author
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the <context-param> tag in the web deployment descriptor (web.xml)
i.e.
<context-param>
<param-name>url</param-name>
<param-value>http://www.mysite.com</param-value>;
</context-param>
This will now be avaliable through the use of ServletContext.getInitParameter(paramName)...
Hope this helps
Sam
 
reply
    Bookmark Topic Watch Topic
  • New Topic