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 -,请问各位大仙怎么解决?
<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 -,请问各位大仙怎么解决?
解决方案 »
- struts2 怎样在视图页面中显示Action验证后的国际化信息?
- java在html页面跳转时保存数据
- 求解!org.xml.sax.SAXException: unable to find FieldDescriptor for 'skinmodule-entr
- <form: action>的简单问题 50分来赚
- Struts2 页面自动赋值问题
- 请教castor问题
- JAVA群诚征有经验人士12956345
- 写了个发送邮件的程序,发布成web service 后为什么总出错?
- 本人已經寫好了一個BEAN管理的實體BEAN,而且也部署好了(weblogic)!但運行測程序的時候出錯了!!!
- ES问题,为什么group by之后返回字段有问题
- xhtml可以使用 frameset 和 iframe吗,
- 正则表达式匹配.和\n,排除]求解
http://127.0.0.1:8080/wapsch/course/course.do?task=courseXml
struts1 path = "/course"的"/"并不是说从根开始
检查下配置,比如web.xml里配置的struts-config.xml路径有没有错,是不是配置了.do的后缀
<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>