课本上的例子,有三个JSP文件,一个主文件,可以跳转到另外两副个文件中,这两个副文件也可以相互跳转。
程序可以运行,但是当从另外两个文件向exampleT.jsp跳转时,exampleT.jsp不显示,它自己也不显示。但exampleS.jsp内容和它一样,但exampleS.jsp可以显示。以下是三个文件和用include嵌入的一个txt文件
我用的是Myeclipse 8.5
主文件exampleF.jsp<%@ page contentType="text/html;charset=GB2312" %>
<A href="exampleS.jsp">欢迎去exampleS.jsp 页面</A>
<P>
<A href="exampleT.jsp">欢迎去exampleT.jsp 页面</A>
<HTML><BODY bgcolor=pink>                                     //还有一个问题为什么这里<html>前有黄色警告。
<P>我是老大页面
</BODY>
</HTML>exampleS.jsp<%@ page contentType="text/html;charset=GB2312"%>
<%@ include file="myfile/ok.txt" %>
<HTML><BODY bgcolor=pink>
<P>我是exampleS.jsp页面
</BODY>
</HTML>
exampleT.jsp<%@ page contentType="text/html; charset=GB2312"%>
<%@ include file="myfile/ok.txt" %>
<HTML><BODY bgcolor=pink> 
<P>我是 exampleT.jsp; 
</BODY>
</HTML>

解决方案 »

  1.   

    两个a链接要放到body里面,不能放到html外面
      

  2.   


    <%@ page contentType="text/html;charset=GB2312" %>
    <HTML>
    <BODY bgcolor=pink>  
    <A href="exampleS.jsp">欢迎去exampleS.jsp 页面</A>
    <P>
    <A href="exampleT.jsp">欢迎去exampleT.jsp 页面</A>                                   
    <P>我是老大页面
    </BODY>
    </HTML>
    应该没了
      

  3.   

    还有呢。。我那个exampleT.jsp为什么不能显示啊?
      

  4.   

    exampleS.jsp
    <%@ page contentType="text/html;charset=GB2312"%>
    <%@ include file="myfile/ok.txt" %>
    <HTML><BODY bgcolor=pink>
    <P>我是exampleS.jsp页面</P>
    <A href="exampleT.jsp">欢迎去exampleS.jsp 页面</A>
    </BODY>
    </HTML>exampleT.jsp<%@ page contentType="text/html; charset=GB2312"%>
    <%@ include file="myfile/ok.txt" %>
    <HTML><BODY bgcolor=pink> 
    <P>我是 exampleT.jsp; </P>
    <A href="exampleS.jsp">欢迎去exampleS.jsp 页面</A>
    </BODY>
    </HTML>
    我试试了可以相互跳转了!不知道楼主是要这个效果不?
      

  5.   

    exampleS.jsp%@ page contentType="text/html;charset=GB2312"%>
    <%@ include file="myfile/ok.txt" %>
    <HTML><BODY bgcolor=pink>
    <P>我是exampleS.jsp页面</P>
    <A href="exampleT.jsp">欢迎去exampleT.jsp 页面</A>--第一个这里写错了 是 exampleT.jsp 
    </BODY>
    </HTML>
      

  6.   

    也可能是路径问题,jsp不要使用相对路径
      

  7.   

    主页面
    index.jsp
    <%@ page contentType="text/html;charset=GB2312" %>
    <HTML>
    <BODY bgcolor=pink>  
    <A href="exampleS.jsp">欢迎去exampleS.jsp 页面</A>
    <P>
    <A href="exampleT.jsp">欢迎去exampleT.jsp 页面</A>                                   
    <P>我是老大页面
    </BODY>
    </HTML>exampleS.jsp<%@ page contentType="text/html;charset=GB2312"%>
    <%@ include file="myfile/ok.txt" %>
    <HTML><BODY bgcolor=pink>
    <P>我是exampleS.jsp页面
    <A href="exampleT.jsp">欢迎去exampleT.jsp 页面</A>
    </BODY>
    </HTML>exampleT.jsp<%@ page contentType="text/html; charset=GB2312"%>
    <%@ include file="myfile/ok.txt" %>
    <HTML><BODY bgcolor=pink> 
    <P>我是 exampleT.jsp; 
    <A href="exampleS.jsp">欢迎去exampleS.jsp 页面</A>
    </BODY>
    </HTML>