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 Populating a list before performing login Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Populating a list before performing login" Watch "Populating a list before performing login" New topic
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: 514
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: 6662
    
    5

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 - More SCJP Mocks
Ankush Kaundal
Ranch Hand

Joined: May 12, 2011
Posts: 36

Go for Filters, it is the best thing you can do without modifying your existing servlets code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating a list before performing login