Solved

How do I import this library

Posted on 2011-09-11
2
272 Views
Last Modified: 2012-05-12
How to import jquery library in a jsp  pop up  been opened by window.open.

I have the jquery.js  location :  webapps/js/jquery.js  folder

and pop up jsp location: webapps/pages/savework/pop_up.jsp

How do I import this jquery library in the pop up jsp page ?

what to write ?  The following does not work in pop up jsp

<script type="text/javascript"
      src="${pageContext.request.contextPath}/js/jquery.js"></script>

0
Comment
Question by:cofactor
  • 2
2 Comments
 
LVL 27

Expert Comment

by:rrz
Comment Utility
>I have the jquery.js  location :  webapps/js/jquery.js  folder  
What is the full absolute path ?
I will presume that "webapps" is the folder in your web server that contains your web apps. If this is true, then instead of  using
>${pageContext.request.contextPath}/js/jquery.js  
you could try using
<%=application.getRealPath("/").substring(0, application.getRealPath("/").indexOf("webapps") + 7)%>/js/jquery.js

>and pop up jsp location: webapps/pages/savework/pop_up.jsp  
I don't think this will work. You will probably have to put pop_up.jsp inside of a web app.
0
 
LVL 27

Accepted Solution

by:
rrz earned 150 total points
Comment Utility
I just realised that if you place the folder js into webapps, then that makes it a web app( tested in Tomcat 7). Same thing with "pages", it is a separate web app.    
So, instead of using
><script type="text/javascript"
      src="${pageContext.request.contextPath}/js/jquery.js"></script>
you can use
<script type="text/javascript"
      src="/js/jquery.js"></script>
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now