Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp onload redirection..

 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

is it possible for a JSP in BEA to redirect onto an Action before the page is loaded.. i have this condition before this jsp is loaded is the value of a certain session variable is say 'Y', then i will redirect this page. Otherwise i will load this jsp file..
 
Joe Ess
Bartender
Pie
Posts: 9265
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do such a thing in a scriptlet but it reeks of bad design. It is far better to keep your logic out of the presentation logic. Why don't you check that session variable in your Action and forward to the appropriate JSP?
 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm. i've thought about and implemented such for now, but i have 7 ACTION going on that jsp page. at the onload event of the jsp page i have to check for that session variable if its on such value i have to bypass the loading of that page and jump to action of that page.

So you imply i should code those condition on each ACTION??



Thank you Joe..
 
Joe Ess
Bartender
Pie
Posts: 9265
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can forward to an action. Have your 7 actions forward to one action that then makes the determination as to which JSP to forward to.
 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
testing.. thanks Joe
[ February 14, 2007: Message edited by: Cyrus Serrano ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic