求助,struts2的convention-plugin配置

wayne很忙 2010-10-28 03:39:48
最近配置了工程中配置了convention-plugin;但是不知道怎么的,action的方法就是访问不到。。
action 如下:

public class TestAction extends BaseAction {


/**
* @Fields serialVersionUID : TODO
*/

private static final long serialVersionUID = 2476727506194464731L;

@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
System.out.println("低调低调低调低调");
return SUCCESS;
}

public String ceshi() throws Exception{
System.out.println("--------------------------------this is test1 method!!");
return SUCCESS;
}
}

访问
http://localhost:8080/oa/test/test.action
能正确的转入结果页面
但是访问http://localhost:8080/oa/test/test!ceshi.action的action方法的时候就是不行
不知道论坛内有了解的没
...全文
86 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq346 2010-10-29
  • 打赏
  • 举报
回复
看过……
arolLiu 2010-10-29
  • 打赏
  • 举报
回复
刚好我也遇到这个问题啊~~

我用的是springside3,也是用convention-plugin,springside3自带的所有页面都没问题,我写了个jsp和action就找不到了,相当郁闷,lz是不是这个错误??

WARN [org.apache.struts2.dispatcher.Dispatcher] - Could not find action or result
There is no Action mapped for namespace / and action name book. - [unknown location]
lzsxf11 2010-10-28
  • 打赏
  • 举报
回复
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
false当然不行啦,改成true
wayne很忙 2010-10-28
  • 打赏
  • 举报
回复
其中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>
<!--默认所有的结果页面存储位置:/WebRoot -->
<constant name="struts.convention.result.path" value="/"/>

<!-- 包路径包含web和action的将被视为Action存在的路径来进行搜索 -->
<constant name="struts.convention.package.locators" value="web,action"/>
<!-- Convention通过如下规则确定URL的具体资源部分:去掉类名的Action部分。然后将将每个分部的首字母转为小写,用’-’分割 -->
<constant name="struts.convention.action.name.separator" value="-" />

<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />

</struts>

81,092

社区成员

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

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