首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

关于struts跳转的有关问题

2012-05-10 
关于struts跳转的问题web.xml中welcome-file-listwelcome-fileindex.jsp/welcome-file/welcome-fil

关于struts跳转的问题
web.xml中
<welcome-file-list>  
  <welcome-file>index.jsp</welcome-file>  
</welcome-file-list> 
jsp中
<% response.sendRedirect("bookindex!visitors.action"); %>
可以跳转到想要的界面visitors.jsp
为什么改成
web.xml中
<welcome-file-list>  
  <welcome-file>bookindex!visitors.action</welcome-file>  
</welcome-file-list>
找不到页面呢?

 

[解决办法]
<welcome-file></welcome-file> 节点中只能包含HTML、HTM、TEXT..。实体物理文件路径,不能访问控制器,你可以配置成<welcome-file>index.jsp </welcome-file>,然后在index.jsp 里做转发:
1.<body onload="javascript:window.location='bookindex!visitors.action';">
2.或者<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <jsp:forward page="bookindex!visitors.action"></jsp:forward>
3.方法很多的可以在百度搜一搜
[解决办法]
你可以选择使用ajax 来实现异步的调用action并把数据写进去。而不用去跳转。

热点排行