Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts and Frames

 
Jag Bains
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have a problem with accessing beans from within jsp pages when they are in frames.
For example, I have a login.jsp which allows a user to login. If sucessfull, it returns a list of menu items. If the resulting page from the login.jsp is a simple page i.e. maintenanceMenu.jsp, then all works fine.
However, if the resulting page is a frame i.e maintenanceFrame.jsp and one of the frames is maintenanceMenu.jsp, then I get the following error.

maintenanceFrame.jsp is

maintenanceMenu.jsp is

Has anyone got any ideas what I am doing wrong?
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For all intents you can think of each frame as a separate browser instance. That is, each frame requires its own request-response cycle to interact with the server. Because you are storing your bean in request scope, it will only be available to the targetted frame. If you have something that must be rad by multiple frames, you will want to use session scope.
IMHO though, the best strategy is to avoid frames when possible. Templating strategies make it simple enough to include common elements (such as menus) on multiple pages without using frames, making it rare when they are actually needed.
 
Jag Bains
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Templates work a treat.
Thanks
Jag
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic