File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Can one jsp file has more than one jQuery script(jQuery supplied) file. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Can one jsp file has more than one jQuery script(jQuery supplied) file." Watch "Can one jsp file has more than one jQuery script(jQuery supplied) file." New topic
Author

Can one jsp file has more than one jQuery script(jQuery supplied) file.

mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 177

Hi, i have a jsp page in which i included three more jsp pages. In each jsp page i am doing some operations using jquery is it necessary to include Jquery script file in all jsp page.
Example i have a menu jsp which is developed using jQuery and a css, it need to include in different jsp pages some of them may have forms then which file should have that jQuery script.?
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

Have you examined what gets sent to the browser as a result of these includes? That will answer your question.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 177

Got it JSP:include includes output(result generated) in the jsp so, if i am not wrong there i have to include jQuery plugin and script file in each jsp page(where ever required)
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

No. Think it through again.

Did you lok at the View Source of what is sent to the browser?
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 177

yes i did, the js file is included twice in the head part when i right click on page and view source. if i use firebug it is showing only one time.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

The thing to remember is that JSP is evaluated on the server in order to create a single HTML page that is sent as the response. If this is not something you are familiar with, perhaps this article will help.

So regardless of how many JSP includes you have on the server -- in fact, no matter what you do on the server to create the response -- a single HTML page is delivered to the browser.

Does that help to answer your question?
 
 
subject: Can one jsp file has more than one jQuery script(jQuery supplied) file.
 
Threads others viewed
Adding jquery to a page
how to use command link in jsf
What does this do? (function($){ ... })(jQuery);
Can you post data from textfields to a URL without having a <form>
page directive
MyEclipse, The Clear Choice