struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Saumets" <>
Subject [S2] LoginAction - Best approach feedback?
Date Tue, 27 Feb 2007 21:29:00 GMT

      Accept        Tentative        Decline        Calendar      
      Accept        Tentative        Decline        Calendar      

Looking for feedback on best way to implement a login action mechanism using Struts2/Spring/JPA

Initially I had declared userName and userPassword setters inside my action class and proceeded
to call
a validateUser method inside my userService class.

the  userService class injects a userdao object and I validate through  calling the userdao
method validate(String username, String password).

This  validate method instantiates a new UserEntity object and a query is  performed (jpa)
grabbing all entities where login = username (which  will be a single entity since username
must be unique).

I have  this approach working. I would like to know if there is a better way to  do this though.
Perhaps by declaring a UserEntity obj inside my  LoginAction class and having setters called
for this obj.

Then I could change my validate to pass along the new UserEntity obj via validate(UserEntity
My problem is I'm not entirely sure how I would compare against data in my db using JPA?

Would  your validate method then have a findAll() method and then iterate  through the list
comparing against new UserEntity obj? That make sense?

That would seem very poor though to be since a large userlist could be taxing to iterate over.

Any guidance or tips? :)

Thanks all!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message