<!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">  </head>
   
  <body>
  <table>
  <tr>
  <td><a href="#" onclick="go('a.jsp')">首页</a></td>
  <td><a href="#" onclick="go('b.jsp')">数据</a></td>
  </tr>
  <tr>
  <td id="content" >
    
  </td>
  </tr>
  </table>
  
  </body>
</html>我想在点首页的时候能把a.jsp页包含到td id为content标签里,效果如下
<td id="content" >
  <jsp:include page="./a.jsp"></jsp:include>   
</td>
在点数据时候,能把b.jsp页包含到td id为content标签里,效果如下
<td id="content" >
  <jsp:include page="./b.jsp"></jsp:include>   
</td>
怎么能实现这种类似于iframe的动态加载而不用iframe吗?注:这个a.jsp/b.jsp是通过js传参过去的。

解决方案 »

  1.   

    其实include只是给程序员看的。编译出来就没什么include了,都是一个页面。就用DIV吧
      

  2.   

    应该不可以,因为jsp:include的作用是,将被包含的jsp的内容,加到当前页面里面来,形成一个文件。而ifream,是将内容引用进来。你做个jsp:include包含一个文件,和ifream引入一个文件,然后分别查看他们的页面源码,就知道区别了。
      

  3.   

    jsp:include是服务器端的操作。
    go()是客户端的操作,所有不发送请求,客户端是不能操作服务器端的。
    当然有个变通的方法,在一开始把两个全取出来。通过隐藏的方式显示一个,点击时显示另一个。