Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-10-2022, 10:24 AM   #1
Senior Member
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,638

Rep: Reputation: 183Reputation: 183
Tomcat not picking up included .js file

I have a .jsp program with the following:
<script src="validEdit.js"></script>
The jsp program calls a function checkFloatAlert(). This file exists, but the jsp program cannot see it. I get the error (Firefox, F12 mode):
Uncaught ReferenceError: checkFloatAlert is not defined
If I rename the file to e.g. booga.js, and change the script src accordingly, it works fine. I've tried renaming this .js several times, all work until I rename it back to validEdit.js.

There are no other .js files included in this JSP. I have also removed all other .js files from the webapps folder. I have restarted tomcat.

Does anyone have any idea why the name of this .js file prevents it from being found? It has been around for a while, so I wonder if there is a version of it cached somewhere? I am completely stymied on this!

I stripped the validEdit.js down to one function:
function howdy()
When I call that i get:
Uncaught ReferenceError: howdy is not defined
If I simply rename validEdit.js to something else like joe.js, it works!

Also, if I use Firefox or Edge on Windows there is no such problem (this issue is using Firefox 102.3.0esr on Linux, kernel version 5.15.63).

So, is "validEdit.js" somehow reserved by Firefox? Is it a caching issue? Any ideas on this?

Last edited by mfoley; 10-10-2022 at 11:47 AM. Reason: more testing ...
Old 10-10-2022, 12:04 PM   #2
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,890
Blog Entries: 1

Rep: Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873Reputation: 1873
Consult Developer Tools (F12), Network tab
Old 10-10-2022, 12:12 PM   #3
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,280
Blog Entries: 24

Rep: Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227
Originally Posted by mfoley View Post
Is it a caching issue?
Almost certainly based on what you have told us.

That is easy enough to test. From the page code just add a unique dummy query string:

<script src="validEdit.js?x=1"></script>
Changing the query string is also a very useful way to force clients to reload a script or css file when you make changes.

I don't do much web development these days, but I have to say that I recently was stumped briefly by Firefox script caching. Shift-refresh used to reload everything but does not appear to on current Firefox.

The only reliable way I discovered (other than query string in the page source) to force a reload of scripts was to open Developer Tools, then open the obscure options menu at far right (...), then open 'Settings' and find the 'Advanced' option (reeks of Windoze 3.1), then find the "Disable HTTP cache when in developer mode" checkbox.

For that to work you have to open Developer tools... very obscure.

Last edited by astrogeek; 10-10-2022 at 01:54 PM.


javascript, jsp

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat picking up deleted cert jeffrosquad Linux - Software 0 01-16-2021 06:46 PM
[SOLVED] drop packet is showing in .cc file but is not included in trace file NS-2 ?? rimonece Linux - Networking 10 11-11-2015 05:51 AM
fresh tomcat 5.5 install not showing tomcat homepage laggerific Linux - Software 0 10-26-2007 03:28 PM
TOMCAT init script not working on startup -- tomcat 4.x / Mandrake Linux 8.0 jmartinph Mandriva 0 03-08-2004 01:31 AM
Why use Apache with Tomcat rather than just Tomcat itself? davee Linux - Software 1 08-21-2003 09:47 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration