• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Loading at statrtUp

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am working on web based project I which using Servlet,JSP and RMI.
I am facing some problem in it So, plz help me in solving it.
Problem is that:-
1.I have one .java file which is calling a .properties file ,I want to Load this .java file when first application is started so we don't have to load it again and again.
2.There is one .java file which work as Registry So,this file will invoke only when Admin login.so plz tell where i have to put this files so it will fullfill my task .

Thanx in advance .
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Regarding point 1, read up on the <load-on-startup> element of the web.xml file. It lets you specify a servlet to be run on startup which can initialize things for you.
Regarding point 2, it sounds like some sort of access control is needed. Using the security-constraint, login-config and security-role elements of web.xml you can specify who has access to which URLs of your web app. You also have to configure a realm in Tomcat; an easy way of doing that is described here.
[ August 29, 2005: Message edited by: Ulf Dittmer ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using a servlet spec 2.3 or greater compliant container, you could also use a Context Listener.

The contextInitialized method will be called before any servlets get loaded.
One advantage is that you don't need to keep track of all of your load-on-startup configurations to make sure that one servlet doesn't load without the required values from another.
 
Whatever you say buddy! And I believe this tiny ad too:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic