Struts2.3+Spring3.2+hibernate4.2 Could not find action or result

flytojiayan 2013-06-22 04:27:01
Struts.xml中第二个package的action可以运行,但第一个package中的action运行总是报错:
There is no Action mapped for namespace [/control/center] and action name [main] associated with context path [/babasport]. - [unknown location]

请各位老师指点指点
下面是源码

struts.xml文件:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.i18n.encoding" value="UTF-8" />
<constant value="true" name="struts.devMode" />
<package name="controlmain" namespace="/control/center" extends="struts-default">
<action name="/main" class="productType">
<result>/WEB-INF/page/controlcenter/default.jsp</result>
</action>
<action name="/top" class="productType" method="top">
<result name="top" >/WEB-INF/page/controlcenter/top.jsp</result>
</action>
<action name="/left" class="productType" method="left">
<result name="left" >/WEB-INF/page/controlcenter/menu.jsp</result>
</action>
<action name="/right" class="productType" method="right">
<result name="right" >/WEB-INF/page/controlcenter/right.jsp</result>
</action>
<action name="/end" class="productType" method="end">
<result name="end" >/WEB-INF/page/controlcenter/end.jsp</result>
</action>
</package>

<package name="producttype" namespace="/" extends="struts-default"><!--
name="productType"用于找action类上@Conponent("productType")的类
--><action name="productTypeList" class="productType" method="listProType">
<result name="list">/WEB-INF/page/product/productList.jsp</result>
</action>
</package>

</struts>


action文件:
@Component("productType")
public class ProductTypeAction extends ActionSupport{
private List<ProductType> type;
private ProductTypeManage typeManage;
public ProductTypeManage getProductTypeManage() {
return typeManage;
}
public List<ProductType> getType() {
return type;
}
public String listProType() throws Exception{
type = typeManage.find(1);
return "list";
}
@Resource(name="productTypeManageImpl")
public void setProductTypeManage(ProductTypeManage productTypeManage) {
this.typeManage = productTypeManage;
}
@Override
public String execute() throws Exception {
return SUCCESS;
}
public String left() throws Exception{
return "left";
}
public String right() throws Exception{
return "right";
}
public String end() throws Exception{
return "end";
}
public String top() throws Exception{
return "top";
}
public void setType(List<ProductType> type) {
this.type = type;
}
}
...全文
102 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
flytojiayan 2013-06-23
  • 打赏
  • 举报
回复
是路径问题,已经解决了,谢谢啊
wasdasdfqwer 2013-06-22
  • 打赏
  • 举报
回复
估计是名称大小写路劲类似的问题,仔细看看

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧