I'm new to Java and to JavaRanch, and am creating a JSP administration page for a website. I am using the jscalendar-1.0 DHTML pop up calendar on this page.
When my page didn't have any JSP code on it, and just HTML, I saved the file as a .html file, and the pop up calendar worked perfectly. But as soon as I saved the same file with .jsp extension, it stopped working.
When I open the JSP page in my IE browser, I get two warnings. One that says "Expected Identifier", and one - "Calendar is undefined".
Here is how I called the files for the calendar on my JSP admin page:
Is something wrong with this? Do the pages need to be called differently from JSP pages?
Did the URL of the page change in any way other than changing html to jsp?
- the jsp and the html file are in different folders
- you are accessing a servlet and forwarding to the jsp. In which case it will look for resources relative to the servlet URL.
Joined: May 24, 2011
Thanks so much for trying to help me out!
The view source doesn't show any difference in the URLs. It shows some JSP code that the .html file doesn't show, but the files called look the same...
The URL of the .jsp page is no different than the URL of the .html page. Except for the extension, of course.
The JS files being called, are in a separate folder within the same folder as the .jsp and .html files are located.
Stefan, what do you mean by this sentence - "- you are accessing a servlet and forwarding to the jsp. In which case it will look for resources relative to the servlet URL."? I'm really new to programming, so I need extra simplified wording and explanations.
Thank you so much! If anyone has any ideas of how I'd solve this problem, please let me know...
Joined: May 24, 2011
I'm not sure what the problem was. Probably something to do with how my files were set up in my directory. But switching from using static html tags to call the JS pages, to including the pages with JSP tags, solved the problem.
Here's what I swapped the html calls for. (Just in case someone else has my problem, too, one day):