Solved

How do I import this library

Posted on 2011-09-11
2
286 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

739 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