Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to load on startup and get an instance of class?  RSS feed

 
Jasiu Stasiu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My problem is:
I have a class that loads some data at startup. Then I want to use that data after submitting the button. I have one class ClassLoadedAtStartup:

and another class MainClass:

and my web.xml:

How to do that? Maybe there is some simplier way.
 
Mohamed Inayath
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First place ClassLoadedAtStartup is not a Servlet.



Second Write a proper servlet and within init() method load your ClassLoadedAtStartup for initialising any data.
 
Jasiu Stasiu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually my class ClassLoadedAtStartup implements ServletContextListener and as I checked it works fine. I have my data loaded at startup. I don't have function init(). Instead of that I put everything I wanted to be initialized in constructor. Sorry, I'm a beginner in JSP, am I doing right?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!