这个struts2为什么报错啊,弄了半天没弄好,求大神指导
action代码
package com.wtu.action.building;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.wtu.entity.Building;
import com.wtu.service.BuildService;
public class FindAllBuilding extends ActionSupport{
private static final long serialVersionUID = 1L;
private BuildService buildService;
public void setBuildService(BuildService buildService) {
this.buildService = buildService;
}
public String findAllBuilding(){
HttpServletRequest request = ServletActionContext.getRequest();
List<Building> list = buildService.findAllBuild();
if(list != null){
request.setAttribute("list", list);
System.out.println("1");
return "s";
}
System.out.println(0);
return "f";
}
}
配置的struts
<package name="findAllBuilding" namespace="/findAllBuilding" extends="struts-default">
<action name="findAllBuilding" class="com.wtu.action.building.FindAllBuilding" method="findAllBuilding">
<result name="s">/build/buildList.jsp</result>
<result name="f">/build/buildFail.jsp</result>
</action>
</package>
链接
<a href="findAllBuilding/findAllBuilding" >楼栋管理</a>
错误信息
19:57:22,937 WARN Dispatcher:49 - Could not find action or result
There is no Action mapped for namespace / and action name findAllBuilding. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)