aspose file tools*
The moose likes JSP and the fly likes jQuery datepicker JSP question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jQuery datepicker JSP question" Watch "jQuery datepicker JSP question" New topic
Author

jQuery datepicker JSP question

Nicolas Constanzo
Greenhorn

Joined: Jul 10, 2011
Posts: 4
Hi I am currently trying to add a datepicker to my website using a Tomcat/Hibernate/jsp environment.
The problem is that I can't seem to be able to load the datepicker function. When I create an empty jsp to try it out it works. Like so:



But when I try to implement it on my webpage it won't work. It currently uses a Servlet to load some information for <select> option boxes. Here is some of the code for this jsp:





Any reason why this wouldn't work? I'm guessing it might be a problem with Tomcat but I'm not sure. Any help would be greatly appreciated.

Thanks,
Nick
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Welcome to the Ranch.

As jQuery is entirely a client-side technology, the issue must be with the HTML that is being sent to the browser. Therefore, the JSP source is not very useful. Rather, please inspect the rendered HTML as it is sent to the browser to see what might be awry.

Also, just saying "it doesn't work" isn't very helpful. What did happen?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nicolas Constanzo
Greenhorn

Joined: Jul 10, 2011
Posts: 4
Sorry for the lack of information on my initial post. It's the first time I post a question on a forum
What I expect to happen is that I want the jQuery datepicker calendar to show up when I click on the input field but when I load the webpage from Safari, locally, using localhost:8080, if I click on the input field the calendar doesn't pop up, it just shows as a blank input field.
What should I be looking for in the rendered HTML to find out what is not working?

Thanks,
Nick
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

I cannot say. Nothing jumps out at me by looking at the JSP source -- frequently page-relative addressing of the script files is a culprit, but not in this case as you are using absolute urls to the google CDN.

Initially, grab the HTML and inspect it for correctness and make sure that what you think should be there is there.

If all looks well, then it is time to start further debugging. For example, making sure that the ready handler is firing as expected. You might have to end up cutting away chunks until you can find what's causing things to boof up.
Nicolas Constanzo
Greenhorn

Joined: Jul 10, 2011
Posts: 4
Well I did what you said and created a temp.jsp and slowly added the pieces of my html code. Turns out I was already loading a different version of jquery at the bottom of the page, so it was trying to load it twice!

and at the end of the page:

Couldn't believe I missed that.

Thanks so much for your help.
Nick
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

 
Don't get me started about those stupid light bulbs.
 
subject: jQuery datepicker JSP question
 
Similar Threads
Modify color of jQuery UI dialog?
JQuery not working
How to Write jQuery into RichFaces?
[Grails] Add form elements with javascript
Struts 2 Jquery autocompleter