This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes how to call  action class on application load Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "how to call  action class on application load" Watch "how to call  action class on application load" New topic
Author

how to call action class on application load

shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
I access my application as http:localhost:8080/miniHR

I want Loginpage to show up whenever someone accesses(i will check if user is in session...etc) the application like this http:localhost:8080/miniHR. I access my login as
http:localhost:8080/miniHR/login/showlogin.do.

How can I call loginaction class automatically when user accesses the application as http:localhost:8080/miniHR.
appreciate your reply.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26183
    
  66

You could subclass the Struts ActionServlet and redirect to the login URL if a session isn't found.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
can you provide me a sample code. I am not clear on how to implement it.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26183
    
  66

response.sendRedirect(url)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to call action class on application load
 
Similar Threads
cookie and login
Problem forwarding to another page using struts.
How to pass two parameters along with URL IN STRUTS2.X
How to run project in WAS5.0 though admin console
requestScope implicit object