• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating a list before performing login

 
anand tiwari
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 544
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ankush Kaundal
Ranch Hand
Posts: 36
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic