• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts - forced welcome page?

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Sheriff
Posts: 17652
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You probably want to do it in a Filter so that you don't have to change much code in all Actions.
 
Clifford Adams
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you give an example of doing this in a filter? I haven't used them before.

Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic