当用sendRedirect方法切换页面时,URL路径会重定向到你所输入的地址。
即我需要切换到的JSP地址:http://localhost:8080/zpw/View/Home_index.jsp
而我的sendRedirect写法为response.sendRedirect("View/Graduate_index.jsp");用sendRedirect切换页面的问题是,用request.setAttribute等request语句把一些值传给JSP页面
----------------------------------------------------------------------------------------
所以我决定了要用forward来进行页面切换
可用forward切换页面的话,貌似URL路径不会重定向,
而还是Servlet的路径:http://localhost:8080/zpw/Servlet
路径不会重定向的结果是,转到JSP页面后,我JSP页面原本的图片没了,超链接也没了(估计是因为路径没切换到JSP页面的路径,所以图片和超链接的地址都不对了),只剩下表格和文字还在(一些与路径无关的东西)。如何解决我用forward时,图片和超链接没了这个问题???
即我需要切换到的JSP地址:http://localhost:8080/zpw/View/Home_index.jsp
而我的sendRedirect写法为response.sendRedirect("View/Graduate_index.jsp");用sendRedirect切换页面的问题是,用request.setAttribute等request语句把一些值传给JSP页面
----------------------------------------------------------------------------------------
所以我决定了要用forward来进行页面切换
可用forward切换页面的话,貌似URL路径不会重定向,
而还是Servlet的路径:http://localhost:8080/zpw/Servlet
路径不会重定向的结果是,转到JSP页面后,我JSP页面原本的图片没了,超链接也没了(估计是因为路径没切换到JSP页面的路径,所以图片和超链接的地址都不对了),只剩下表格和文字还在(一些与路径无关的东西)。如何解决我用forward时,图片和超链接没了这个问题???
Servlet:
//response.sendRedirect("View/Home_index.jsp");
disp = request.getRequestDispatcher("/View/Home_index.jsp");
disp.include(request, response);所要切换的JSP页面:
<jsp:include page="Top.jsp" flush="true"/>
<jsp:include page="Home_navigation.jsp" flush="true"/>
<table width="778" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="190" height="600"><jsp:include page="Home_left.jsp" flush="true"/></td>
<td><jsp:include page="Right.jsp" flush="true"/></td>
</tr>
</table>
<jsp:include page="Bottom.jsp" flush="true"/>其中一个JSP页面里面的图片地址连接:
<td height="134" valign="top" background="../Images/login_bottom.jpg">