| Author |
Populating a list before performing login
|
anand tiwari
Greenhorn
Joined: May 05, 2007
Posts: 1
|
|
Hi all,
I need to implement a particular logic in my web application (its a struts application) where I want to populate an arraylist before the user performs the login operation. This is needed as I want to compare certain user attributes after the user had logged in.
Can this be done using a separate servlet having the load-on-startup value specified? Will the particular servlet be available only when i restart the servlet or it will be available if I redeploy the application?
Can someone please suggest an appropriate solution for the same as I am new to both servlets and struts.
Thanks.
|
 |
amit punekar
Ranch Hand
Joined: May 14, 2004
Posts: 488
|
|
Hello,
You can use a Servlet Filter to do this.
You need to
1) Implement the business logic that you mentioned in the Servlet Filter class
2) Configure this filter to be invoked whenever your login servlet gets called
Regards,
Amit
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6588
|
|
If this is a one time operation I would suggest taking a look at a servletcontextlistener instead.
http://download.oracle.com/javaee/5/api/javax/servlet/ServletContextListener.html
|
SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
|
 |
Ankush Kaundal
Ranch Hand
Joined: May 12, 2011
Posts: 30
|
|
|
Go for Filters, it is the best thing you can do without modifying your existing servlets code.
|
 |
 |
|
|
subject: Populating a list before performing login
|
|
|