This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
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: 30057
    
149

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: 30057
    
149

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