Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

request attributes being lost  RSS feed

 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a question regarding the scope of the request variables when frames are used.I have a link from which i go to an action and store some variables in req scope and will reach a jsp which is made up of three frames and the middle frame is a jsp which in turn comprises of frames.Now in these jsps i am not able to access the request attributes.

For ex

action path="/login" type="LoginAction" name="LoginForm" validate="true" input="/login.jsp"
forward name="operator" path="/index.jsp"

and the index.jsp is

<frameset framespacing="0" border="0" rows="55,80%,23" frameborder="0">
<frame name="top" scrolling="no" noresize target="middle" src="top_frame.jsp">
<frame name="middle" target="bottom" src="home.jsp" scrolling="no" noresize>
<frame name="bottom" src="bottom_frame.jsp" target="middle" scrolling="no" noresize>
</frameset>

and the middle part in the above frame ie home.jsp is like

<frameset framespacing="0" border="0" rows="55,80%,23" frameborder="0">
<frame name="middle" target="bottom" src="body1.jsp" scrolling="no" noresize>
<frame name="bottom" src="body2.jsp" target="middle" scrolling="no" noresize>
</frameset>

The problem is that these request variables are not available yo body1.jsp and body2.jsp.........whats the best way to make these attributes available to these pages also ...............
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Best solution (seriously), stop using frames. They're usually more trouble than they're worth, and the overhead for downloading the extra data isn't that bad if you put some effort into the design. They also create some annoying usability and security issues.

The problem you are seeing here is that the user logs in, then the index.jsp page (including frames) is sent. The index.jsp sends a new request for each frame page which obviously doesn't include the initial request.

The easiest (but not best) way would be to place the data on the session after the initial request, then you are no longer have to worry. As long as the data is only used by the next request, (ie body1 and body2) this may be your best bet.
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

thanks for ur reply ...why i am sticking to frames is that there are a few parts which are static in my page like header and they dont want to be refreshed everytime .....hence i am going for tiles ..

And if i go on keeping the data in session i have many pages in my application will this be a good idea else is there any other way of achieving this
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have static pages then why don't you use <div> tag of HTML. Make the header page seperate and then in your index page use <div> tag and include that html page in your index.jsp page.

Frames are not good to use i think.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!