Solved

How do I import this library

Posted on 2011-09-11
2
277 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.

772 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