Solved

How do I import this library

Posted on 2011-09-11
2
274 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
ID: 36519288
>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
ID: 36519370
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
network + 7 80
what is the difference between "sudo su" and "su - root" 6 102
get weblogic logged in user in java 2 57
how do i compare an object based on two fields 6 48
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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 …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

929 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

13 Experts available now in Live!

Get 1:1 Help Now