Struts配置
<action
path="/articleQuery"
validate="false" >
<forward name="next" path="/show_article.jsp"/>
</action>
Spring配置
<bean name="/articleQuery" class="nuc.hailang.struts.article.ArticleAction">
<property name="articleService" ref="articleService"/>
</bean>
页面跳转
<td width="40%" align="center">
<html:link action="/articleQuery.do?name=${community.name}">
${community.name}
</html:link>
</td>
这个community是保存在request中的,能顺利取得
articleQueryAction
public class ArticleQueryAction extends Action {
private ArticleService articleService;
public void setArticleService(ArticleService articleService) {
this.articleService = articleService;
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String name = request.getParameter("name");
System.out.println(name);
List list = articleService.queryByCommunity(name);
request.setAttribute("articles", list);
return mapping.findForward("next");
}
}
点那个链接进去就报异常
javax.servlet.ServletException: DispatchMapping[/articleQuery] does not define a handler property
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:176)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
nuc.hailang.util.SetCharacterEncoding.doFilter(SetCharacterEncoding.java:22)
哪位达人帮忙看看?感觉很简单的内容出现很奇异的问题。
------解决方案--------------------
class ArticleQueryAction extends Action
这个Action到底是 继承自 DispatchAction 还是Action
怎么看你的信息是Dispatch 的Action 没有指定相应的方法
------解决方案--------------------
<action
path="/articleQuery"
type呢~~~~~~~~~
validate="false" >
<forward name="next" path="/show_article.jsp"/ >
</action >
------解决方案--------------------
struts-config.xml中加入
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/bean-config.xml"/>
</plug-in>
用来和spring联系。
然后
<action
path="/articleQuery"
type=“org.springframework.web.struts.DelegatingActionProxy”
validate="false" >
<forward name="next" path="/show_article.jsp"/ >
</action >
用来将/articleQuery的请求代理到spring中进行。
------解决方案--------------------
帮楼主顶起来:
我
顶顶顶顶顶
顶顶顶顶顶
顶顶顶顶顶
顶顶顶顶顶
顶顶顶顶顶
------解决方案--------------------