LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

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


I have a .jsp program with the following:
Code:
<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):
Code:
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:
Code:
function howdy()
{
    alert('hello');
}
When I call that i get:
Code:
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 12:47 PM. Reason: more testing ...
 
Old 10-10-2022, 01:04 PM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,387
Blog Entries: 1

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

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Quote:
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:

Code:
<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 02:54 PM.
 
  


Reply

Tags
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 07: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 06:51 AM
fresh tomcat 5.5 install not showing tomcat homepage laggerific Linux - Software 0 10-26-2007 04:28 PM
TOMCAT init script not working on startup -- tomcat 4.x / Mandrake Linux 8.0 jmartinph Mandriva 0 03-08-2004 02:31 AM
Why use Apache with Tomcat rather than just Tomcat itself? davee Linux - Software 1 08-21-2003 10:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:52 PM.

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