Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

login screens

 
Scott Allen Mueller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been out of the servlet loop for a while... Now I need to create a webapp with, of course, a login screen and even login sections on pages like the homepage. How is this handled nowadays? I used to have to setup a <security-constraint> element in the web.xml file with a url pattern for pages that required a login. Then when you try to navigate to those pages it would bring you to the defined login page (in the <login-config> element). But I forget, and I assume there's a better way now, for example how to deal with homepages with login sections.
 
dema rogatkin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I heard about filters.
 
Scott Allen Mueller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I use filters to have a login section on the homepage?
 
Manuel Palacio
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been doing this with Acegi Security, the security framework for Spring: Acegi

You can map URLs to different roles that you have defined in, for example, a database. It uses filters to do this.

I don't think there's a better way in the latest specification to deal with those things. On the other hand, we have frameworks like Acegi that make this easy and portable.

You can also write a filter that does simple autentication, perhaps checking for the existence of a certain variable in the session.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic