<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
  <head>
    <title>测试</title>
  </head>
  
  <body>
  <c:catch var="error">
<c:import url="www.baidu.com"  charEncoding="UTF-8" />
  </c:catch>
  <c:if test="${!empty error}">
   该网址不存在,请确认是否登录到Internet!
  </c:if>
  </body>
</html>
我在一个叫aa的web project里面的index.jsp运行上面代码,为什么有HTTP Status 404 - /aa/这个错误。。
type Status reportmessage /aa/description The requested resource (/aa/) is not available.
转不到百度的网页?

解决方案 »

  1.   

    上面那个问题我解决了。。现在有个问题是
    我在一个叫7.11的web project运行下面jsp代码
    <%@ page language="java" pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <html>
      <head>
        <title>应用&lt;c:import&gt;标签在网页中显示天气预报</title>
      </head>
      
      <body>
      <c:catch var="error">
    <c:import url="www.baidu.com" charEncoding="UTF-8"/>
      </c:catch>
      <c:if test="${!empty error}">
       该网址不存在,请确认是否登录到Internet!
      </c:if>  </body>
    </html>
    怎么提示The requested resource (/7_weather/www.baidu.com) is not available 
    7_weather是哪里来的?我在web.xml都找不到这个在线等
      

  2.   

    /7_weather/www.baidu.com  这个路径到baidu肯定不行的 ,去百度的路径只能是http://www.baidu.com
    而你的路径是http://localhost/7.11/7_weather/www.baidu.com  怎么可能去得了baidu