• 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

jsp not reloaded in frame

 
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted a thread in javascript for <iframe>. Now I am facing a page not reloaded problem inside the frame.





I have a "show hidden page" button, when user clicks the button, it invokes a javascript to set the <div> as visible. What I found was -- First time clicking the button, the hidden jsp shows up, initially all radio button were unchecked as designed , then I clicked the 2nd radio button. Then I click on some other irrelated stuff on the main page (my.html) but not inside the app.jsp. Then I clicked the "show hidden page" again, the page poped up again, but to my surprise, it did not show me the original jsp (i.e. all radio button should be unchecked), it showed me my modified page --- it showed me that 2nd radio button was checked, i.e. it cached what I clicked around on app.jsp, instead of reloading the app.jsp from server.

How to fix this issue ?

Thanks,
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the HTML forum as this has nothing to do with JSP.

Just hiding and showing will not cause the iframe to reload. Why would you think that it would? It's simply a display setting.

To reload the iframe reset its src attribute.
 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is a content display panel and we only want to show user when they choose to click on the link to see. Howevere, we want the content to be reloaded and refreshed from server everytime when they click to see. Could you be more specific how we can achieve that ?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:To reload the iframe reset its src attribute.

 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry, maybe i am just stupid. I don't know how i can reset the "src" attribute. This "src" URL (a jsp) is a fixed URL. I am not supposed to change it. I just want it to be reloaded as fresh when this iframe displays. I really don't know ho this can be "reset". Thanks.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You might need to add some random value to the query string to defeat any caching.
 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my "show hidden page" button's onClick() function I made the hidden iframe visible but its content turned not be reloaded everytime when I hit the "show hidden page" button.

After I saw Bear's post, I added into onClick() function. But it did not work. It did not show me the reloaded original jsp page when I clicked the button. Note: java]document.getElementById('myFrame').src='..../my.jsp'; the content src points to is same as what I put for src inside the <iframe> element. I just repeated it in onClick() hoping it reloads the page.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The page in the iframe is probably cached. That is what GET requests do when you do not set proper headers.

You can also refresh the iframe via



Eric
 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
maybe this is a stupid idea --- What if I create an action which forward to "my.jsp" and I use

<iframe src="/../myaction">

This may force the server render a jsp everytime.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try the reload() method Eric suggested?

Also, have you checked to make sure that response has the proper no-cache headers?
 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear, I am sorry to say that it did not work for me.

As I said, I have a click button, when it clicks it shows the hidden iFrame.



The iFrame embeds a jsp page which includes some elements. Every time after I click something on the jsp, it "memorize' it, i.e. when I click somewhere else on the main page and then click back the button, it pops up the iframe with the jsp I already clicked around instead of a fresh jsp. Did I use the syntax correctly ??

Thanks.

 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
finally that "reload" javscript syntax worked for me. Thanks !
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic