最近配置了工程中配置了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方法的时候就是不行
不知道论坛内有了解的没

解决方案 »

  1.   

    其中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>
      

  2.   

    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    false当然不行啦,改成true
      

  3.   

    刚好我也遇到这个问题啊~~我用的是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]