1.   <form-bean name="courseform" type="com.doone.wap.education.course.CourseForm"/>
<action 
   path = "/course"
   type = "org.springframework.web.struts.DelegatingActionProxy"  
   name = "courseform"
   scope = "request"
   parameter = "task"
   validate="false"
   >
   </action>
2.<bean name="courseDao" class="com.doone.wap.education.course.CourseDao" >
<property name="sqlMapClient" ref="sqlMapClient"></property>
</bean>
<bean id="courseProxy" parent="baseTransactionProxy">
<property name="target" ref="courseDao"></property>
</bean>
<bean name="/course" class="com.doone.wap.education.course.CourseAction">
<property name="courseProxy" ref="courseProxy"></property>
</bean>
3.public class CourseAction extends DispatchAction {
private ICourseDao courseProxy = null;
private long planResultId;
public ICourseDao getCourseProxy() {
return courseProxy;
}
public void setCourseProxy(ICourseDao courseProxy) {
this.courseProxy = courseProxy;
}
public ActionForward courseXml(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

String currentPage = request.getParameter("currentPage");
String pageSize = request.getParameter("pageSize");
String questId = request.getParameter("planResultId");
if(questId!=null && !"".equals(questId.trim())){
HashMap searchMap = new HashMap();
int cp = 0;
int ps = 8;
if(pageSize!=null && !"".equals(pageSize.trim())){//每页显示几条
ps = Integer.parseInt(pageSize);
}
if(currentPage!=null && !"".equals(currentPage.trim())){//显示第几页
cp = (Integer.parseInt(currentPage)-1)*ps;
}
searchMap.put("planResultId", planResultId);
//studentProxy.findQuesAnswPage(searchMap, cp, ps)
List tempList =courseProxy.findCourseoLists(searchMap, cp, ps); ;
response.setContentType("text/xml");
String realpath = this.servlet.getServletContext().getRealPath("education");//获取电子书包工程的文件
String path = realpath+"/init.ini";
Config config = new Config(path);
realpath = config.getValue("realpath");
Document doc = XMLUtils.createAnswerDocument(tempList,realpath);
try {
PrintWriter out = response.getWriter();
out.print(doc.asXML());
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}

}
输入http://127.0.0.1:8080/wapsch/course.do?task=courseXml,报HTTP Status 404 -,请问各位大仙怎么解决?

解决方案 »

  1.   

    是不是有个course包目录,你试下
    http://127.0.0.1:8080/wapsch/course/course.do?task=courseXml
    struts1 path = "/course"的"/"并不是说从根开始
      

  2.   

    你是不是就配置在WEB-INF或classes下的struts-config.xml下,这样是不需要加上course(我用的系统是拆成很多个配置文件)。
    检查下配置,比如web.xml里配置的struts-config.xml路径有没有错,是不是配置了.do的后缀
      

  3.   

    classes\com\doone\wap\education\course
      

  4.   

    你把web.xml里引入这个struts配置文件的那一段贴出来我看下
      

  5.   

     <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml,/WEB-INF/struts-config-lll.xml</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>3</param-value>
        </init-param>
        <init-param>
          <param-name>detail</param-name>
          <param-value>3</param-value>
        </init-param>
        <load-on-startup>0</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
      

  6.   

    http://127.0.0.1:8080/wapsch/course.do?task=courseXml路径是没错的,看有木有人来解答,我也有一段时间没有struts1了。