File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes tomcat properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "tomcat properties" Watch "tomcat properties" New topic
Author

tomcat properties

SoonAnn Lim
Ranch Hand

Joined: Jun 21, 2001
Posts: 155
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.
Sam Dalton
Author
Ranch Hand

Joined: Jul 26, 2001
Posts: 170
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

<a href="http://www.samjdalton.com" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of [http://www.amazon.com/exec/obidos/tg/detail/-/1590592255/qid=1068633302//ref=sr_8_xs_ap_i0_xgl14/104-4904002-9274339?v=glance&s=books&n=507846]Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1861007701/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100561X/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat properties
 
Similar Threads
Is there a max number of variables that can be used in any JSP?
Scripting-Invalid(Usage)
Servlet Alias
.jspf file not behaving as .jsp file: example in HFSJ
Default servlet and static content