Javaweb工程找不到jquery问题

当在静态页面中引用jquery相当简单,只需要在head内加上<script src="jquery路径">就可以了。但是在web工程中使用上面的方法就发现找不到jquery。当时郁闷了很久,上网也找了很多依然没有解决。后来我想到要在路径前加点,于是我非常任性的在前面加了两个点。但是并没有什么卵用。
下面给个简单的例子。并不具备任何意义
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">

    <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <script type="text/javascript" src="/jquery-1.4.1.min.js"></script>
    <script type="text/javascript">
        function fun(){
            alert("In....");
            alert($("#tb"));
            alert($("#text").val());

        }
    </script>
  </head>

  <body>
    <form action="">
        <table id="tb">
            <tr><td><input type="text" id="text" value="123"></td></tr>
            <tr><td><input type="button" value="Click" onclick="fun()">
        </table>
    </form>
  </body>
</html>

jquery路径

ok,按道理说应该是没问题的,但是在我的myeclipse中就是找不到jquery。

于是,我在路径前加了两个点

<script type="text/javascript" src="../jquery-1.4.1.min.js"></script>

并没有什么卵用!!!!

后来,妈的只加一个点!!!!

<script type="text/javascript" src="./jquery-1.4.1.min.js"></script>

问题解决了!坑爹的点啊。希望能帮到遇到相同问题的你

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值