Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes Struts - forced welcome page? 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 "Struts - forced welcome page?" Watch "Struts - forced welcome page?" New topic
Author

Struts - forced welcome page?

Clifford Adams
Ranch Hand

Joined: May 12, 2004
Posts: 50
Is there a way to force all users of my struts app to start at the welcome page? for example, If someone bookmarks http://www/projects/loadProject.do?id=45 it will instead force them to go to http://www/projects/index.jsp

Thanks!
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4442
    
    5

You can use tokens to flag valid submissions. See the Struts JavaDocs for Action.isTokenValid(), Action.saveToken(), Action.resetToken(). See also this article

Here's the logic:

if (!isTokenValid(request)) {
return mapping.findForward("home"); // where "home" is a global forward
}

You might also check for some object in the session scope that indicate that a user has properly logged in to the application. If the object is not there, you'd forward to the home page.
[ November 30, 2004: Message edited by: Junilu Lacar ]

Junilu - [How to Ask Questions] [How to Answer Questions]
Tony Yan
Ranch Hand

Joined: Apr 10, 2002
Posts: 170
You probably want to do it in a Filter so that you don't have to change much code in all Actions.


Tony Yan<br /> <br />IBM Certified Developer XML and Related Technology<br />Sun Certified Web Component Developer For J2EE Platform<br />Sun Certified Programmer For Java 2 Platform
Clifford Adams
Ranch Hand

Joined: May 12, 2004
Posts: 50
Can you give an example of doing this in a filter? I haven't used them before.

Thanks
 
jQuery in Action, 2nd edition
 
subject: Struts - forced welcome page?
 
Similar Threads
BSF!!!
wanna know about prometric institutes
Exam
SCBCD Exam + Availability in Australia
Java Heap Problem