小弟初学struts2,手头上有个struts1.2的小项目,就想拿来练练手。完全跟着视频上的做法来做的,没想到就是提示在WEBROOT下找不到song.do文件。再此只能麻烦各位浪费点时间帮我看看是什么问题,先在此谢过这是struts1.2的struts-config.xml文件<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
  <data-sources />
  <form-beans>
   <form-bean name="songForm" type="com.model.SongForm"/>
   <form-bean name="managerForm" type="com.model.ManagerForm"/>
  </form-beans>
  <global-exceptions />
  <global-forwards />
  <action-mappings>
   <action name="songForm" path="/song" scope="request" type="com.action.SongAction" validate="true">
   <forward name="main" path="/main.jsp"/>
   <forward name="songQuery" path="/songList.jsp"/>
   <forward name="search" path="/searchResult.jsp"/>
   <forward name="download" path="/download.jsp"/>
   <forward name="tryListen" path="/tryListen.jsp"/>
   <forward name="continuePlay" path="/continuePlay.jsp"/>
   <forward name="adm_search" path="/adm_main.jsp"/>
   <forward name="addok" path="/addok.jsp"/>
   <forward name="checkMusic" path="/checkMusic.jsp"/>
   <forward name="delok" path="/delok.jsp"/>
   <forward name="error" path="/error.jsp"/>
   </action>
      <action name="managerForm" path="/manager" scope="request" type="com.action.ManagerAction" validate="true">
   <forward name="managerLoginok" path="/login_ok.jsp"/>
   <forward name="error" path="/error.jsp"/>
   </action>
  </action-mappings>
  <controller processorClass="com.action.SelfRequestProcessor" />
  <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
</struts-config>以下是main.jsp<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
  <head>
    <title>在线音乐</title>
<link href="CSS/style.css" rel="stylesheet"/>
<script language="javascript"> 
//控制复选框的全选或反选操作
function CheckAll(elementsA,elementsB){
for(i=0;i<elementsA.length;i++){
elementsA[i].checked = true;
}
if(elementsB.checked ==false){
for(j=0;j<elementsA.length;j++){
elementsA[j].checked = false;
}
}
}
//判断用户是否选择了要播放的歌曲,如果没有选择,则提示“请选择要播放的歌曲”;否则提交表单进行播放
function continuePlay(playId,formname){
var flag = false;
for(i=0;i<playId.length;i++){
if(playId[i].checked){
flag = true;
break;
}
}
if(!flag){
alert("请选择要播放的记录!");
return false;
}else{
formname.submit();
}
}
</script> 
  </head>
  
  <body>
<jsp:include page="top.jsp"/><!--包含导航栏-->
<jsp:include page="song.do" flush="true">      //此行报错,有关于song.do的都报错,提示找不到song.do
  <jsp:param name="action" value="navigation"/>
 </jsp:include>
<!-------------->
<div id="main">
<div id="index_main"><img src="images/ad.jpg" width="649" height="67"><table width="100%"border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td height="5" bgcolor="#E2F1EE"></td>
    </tr>
    <tr>
      <td height="5" bgcolor="#FFFFFF"></td>
    </tr>
  </table>
<%
String requestPara="";
String[][] typeArray=(String[][])request.getAttribute("typeArray");
for(int i=0;i<6;i++){
requestPara="newSongList"+i;
if(i%2==0){
%>
  <table width="98%" height="96" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td valign="top"><%@ include file="newSongList.jsp"%></td>
  <%}else{%>
      <td valign="top"><%@ include file="newSongList.jsp"%></td>
    </tr>
  </table>
   <hr size="1" width="98%" align="center"> 
  <br> 
  
  <%}
  }%>  </div>
<div id="index_right" style="float:left;width:220px; margin-left:5px;">
  <table width="100%" height="56" border="0" cellpadding="0" cellspacing="0" style="padding-left:5px" class="tableBorder">
    <tr>
      <td width="4%" height="27" valign="middle" bgcolor="#CFED0A" class="word_darkGreen"><img src="images/title_ico.gif"></td>
      <td width="96%" valign="middle" bgcolor="#CFED0A" class="word_darkGreen">试听排行榜</td>
    </tr>
    <tr>
      <td colspan="2"><jsp:include page="song.do" flush="true">
  <jsp:param name="action" value="songSort"/>
  <jsp:param name="sortType" value="hits"/>
  </jsp:include>   </td>
    </tr>
  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="5"></td>
    </tr>
  </table> 
  <table width="100%" height="56" border="0" cellpadding="0" cellspacing="0" style="padding-left:5px" class="tableBorder">
    <tr>
      <td width="4%" height="27" valign="middle" bgcolor="#CFED0A" class="word_darkGreen"><img src="images/title_ico.gif"></td>
      <td width="96%" valign="middle" bgcolor="#CFED0A" class="word_darkGreen">下载排行榜</td>
    </tr>
    <tr>
      <td colspan="2"><jsp:include page="song.do" flush="true">
  <jsp:param name="action" value="songSort"/>
  <jsp:param name="sortType" value="download"/>
  </jsp:include>   </td>
    </tr>
  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>&nbsp;</td>
    </tr>
  </table>  
</div>
</div><jsp:include page="copyright.jsp"/>
  </body>
</html>

解决方案 »

  1.   

    <jsp:include page="classpath*:song.do" flush="true">试试看
      

  2.   

    你直接在ie地址栏里访问会不会出问题?要不把.do去掉?还有你看路径是否正确。
      

  3.   

    你不是说的你在学习struts2的嘛!但是你安装struts1.2的项目做!肯定是错的三!struts1和struts2两个就不一样的
      

  4.   

    [Quote=引用 1 楼 huahuagongzi9999 的回复:]加上还是同样的问题
      

  5.   


    嗯,这个知道。但是我是按struts1.2的步骤来安装的,都是一些struts1.2的jar包,不是这个存在问题
      

  6.   

    1、你这是struts 1.x吧2、试试<jsp:include page="<%=request.getContextPath()%>/song.do" flush="true"> 3、确定你的web.xml中,struts url mapping是*.do