aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Javascript not running on next page in displaytag.tld Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Javascript not running on next page in displaytag.tld" Watch "Javascript not running on next page in displaytag.tld" New topic
Author

Javascript not running on next page in displaytag.tld

Eric Juneau
Greenhorn

Joined: Jul 13, 2009
Posts: 28
I have a JSP that has two tables, each uses displaytag. One of them is hidden (you switch back and forth between them like tabs) within a div. I have some javascript that runs when the page loads that hides table 2, and when you click either tab, it hides the appropriate div and shows the one you clicked un.

But when you click the next page of the table, the page refreshes, but the javascript does not run. In fact, it looks like all the javascript on this page has disappeared completely. Does anyone know why? And how do I re-enable/recover the javascript functionality?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56179
    
  13

If the page is refreshing from the server, then it will have whatever's sent. Have you checked the response to see if the JavaScript is there?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Eric Juneau
Greenhorn

Joined: Jul 13, 2009
Posts: 28
After further research, I got it. I had the id attribute of the display:table tag the same for both tables. Apparently, it doesn't mind this when first loading the page, but it cared when I tried to change pages on one table. I changed the id= of the second table and now it works.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Javascript not running on next page in displaytag.tld
 
Similar Threads
Contents are not getting updated using Javascript
have two tables I am trying to use jquery accordion effect on
How to get onclick value from button which is there in hidden div?
Hiding a popup span with onblur
jQuery AJAX display issue