Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Originally posted by Satou kurinosuke:
You need a reference to a HttpServletRequest to make a new session, so it won't work in an ordinary class.
what if i like to know how to do it with ordenry class?
can i tell tomcat to run ordenry java class first when
my webapp is started , i know how to do it with servlet , but not with
simple class
If you're using at least Servlet API 2.3, then you can use the javax.servlet.ServletContextListener to run code at startup time. That's much to be preferred over the load-at-startup setting in web.xml.
[My Blog]
All roads lead to JavaRanch
And just to make sure there's no confusion, don't expect to make a new session from a ServletContextListener.
Don't get me started about those stupid light bulbs. |