浏览 2919 次
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2008-07-28
继承MultiActionController的SysAdminAction类 package com.wop.website.action; import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.wop.common.springframework.web.servlet.ModelAndView; public class SysAdminAction extends org.springframework.web.servlet.mvc.multiaction.MultiActionController { public String toView; public void showSysAdminFrame(HttpServletRequest request, HttpServletResponse response,ModelAndView mav) throws Exception { System.out.println(this.getClass() + "." + "showSysAdminFrame()"); mav.setViewName(this.toView); //return new ModelAndView("/sysadmin/common/sysAdminFrame"); } public ModelAndView doTree(HttpServletRequest request, HttpServletResponse response,Exception e){ System.out.println(this.getClass() + "." + "showTree()"); return new ModelAndView("sysAdminBar"); //return new ModelAndView(this.toView,new HashMap()); //return null; } public String getToView() { return toView; } public void setToView(String toView) { this.toView = toView; } }
actionConfig.xml配置springMVC
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/sysAdmin.html">sysAdminAction</prop> </props> </property> </bean> </bean> <bean id="paraMethodNameResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver"> <property name="paramName" value="method" /> </bean> <bean id="sysAdminAction" class="com.wop.website.action.SysAdminAction"> <property name="methodNameResolver" ref="paraMethodNameResolver" /> <property name="toView"> <value>sysAdminBar</value> </property> </bean> </beans>
freeMarker配置在springConfig.xml如下: <!-- freeMarker环境 --> <bean class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> <property name="templateLoaderPath" value="/WEB-INF/ftl" /> <property name="defaultEncoding" value="UTF-8" /> <property name="freemarkerSettings"> <props> <prop key="template_update_delay">1000</prop> <prop key="locale">zh_CN</prop> </props> </property> </bean> <!-- freeMarker视图 --> <bean class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"> <property name="suffix" value=".ftl" /> <property name="contentType" value="text/html;charset=utf-8" /> <property name="exposeRequestAttributes" value="true" /> <property name="exposeSessionAttributes" value="true" /> </bean>
当访问action中的两个方法时,问题出现了。。
http://127.0.0.1/sysAdmin.html?method=showSysAdminFrame
当方法使用void时,url请求正常。
http://http://127.0.0.1/sysAdmin.html?method=doTree
当方式使用ModelAndView时,URL请求不到,tomcat报warn错误:
warn错误是:
2008-07-27 23:57:28,487 WARN [http-80-Processor25] (MultiActionController.java:394) - No request handling method with name 'doTree' in class [com.wop.website.action.SysAdminAction]
究竟这是什么问题,什么环节出错?
有谁能解决吗?
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |