Link to Javascript libraries with Tomcat

I am using Eclipse Ganymede and Tomcat 5.5 . I would like to add some javascript and especially ajax functions to a dynamic web project and need some help.

I would like to use jquery (but I am open to other suggestions if you tell me why another library would be better in this case, but I chose jquery because it should be simple (which at first glance it seems)).

I have two problems:

1- Tomcat cannot find jquery library. I tried several things in my jsp file, for example:

   <script type="text/javascript" src="WEB-INF/lib/jquery-1.3.2.min.js"></script>
   <script type="text/javascript" src="/WEB-INF/lib/jquery-1.3.2.min.js"></script>
   <script type="text/javascript" src="./WEB-INF/lib/jquery-1.3.2.min.js"></script>

As you can see, I dropped the jquery's library /WEB-INF/lib. Running a jsp file in a browser without tomcat (with the latest version of the path) works, so the path is correct.

2. In a dynamic web project for jquery, there are no syntax tooltips and no tooltips. I also tried the information in this article , but that hasn't changed much.

+3
source share
4 answers

To be more specific (because it took me about half an hour to figure this out after reaching this goal):

- Tomcat Eclipse, , "WebContent". , , Tomcat, Eclipse Tomcat/webapps/<project name> ( , ). META-INF WEB-INF, .

, WebContent Javascript . , (, , ) Javascript.

, "script" WebContent Javascript; , , src="ProjectName/script/AwesomesauceJavascript.js"

+5

, @Tacroy. , Eclipse, server.xml. , :

Context docBase="SomeProjectName" path="/SomeProjectName" < - docBase .

, src jsp.

0

, jquery.js script. .

, :

<resources mapping="/scripts/**" location="/WEB-INF/scripts/**" />

:

<script type="text/javascript" src="scripts/jquery-1.10.2.js" ></script>
0

jQuery Eclipse.

  • jqueryWTP0.40foEn.jar.

  • Eclipse org.eclipse.wst.jsdt.core_version.jar, . (, C:\DEV\EclipseIndigo37\eclipse\plugins \ Org.eclipse.wst.jsdt.core_1.1.100.v201104272153.jar)

  • JAR java -jar jqueryWTP0.40foEn.jar.

  • swing org.eclipse.wst.jsdt.core_version.jar .

  • .

  • org.eclipse.wst.jsdt.core_version.jar .

  • workspace/.metadata/.plugins/org.eclipse.wst.jsdt.core

  • Eclipse.

  • HTML JavaScript, JavaScript.

jQuery .

-2
source

Source: https://habr.com/ru/post/1710896/


All Articles