2
回答
JFinal路由配置总出错,没理解啊!
华为云实践训练营,热门技术免费实践!>>>   

求教:JFinal关于actionKey/method的问题

config中配置如下:

me.add("/test",TestJFinal.class,"bizroot/test");

me.add("/getAutoDatas",TestJFinal.class);

controller写的方法

public class TestJFinal extends Controller{
public void index(){
render("autocomplete.jsp");
}
public void welCome(){
render("welcome.jsp");
}


public void getAutoDatas(){
List<Record> users = Db.find("select loginId regionCode,UserName regionName from user");
renderJson(users);
}
}

一直提交 getAutoDatas已经存在,晕了。

jsp调用如下:

 $.post("/test/autodata",{"matchInfo":query,"matchCount":matchCount},function(respData){
                return process(respData);
            });

错误信息:



Exception: The action "demo.action.TestJFinal.getAutoDatas()" can not be mapped, actionKey "/getAutoDatas" is already in use.
2015-07-09 12:25:08.884:WARN:oejuc.AbstractLifeCycle:FAILED jfinal: java.lang.RuntimeException: The action "demo.action.TestJFinal.getAutoDatas()" can not be mapped, actionKey "/getAutoDatas" is already in use.
java.lang.RuntimeException: The action "demo.action.TestJFinal.getAutoDatas()" can not be mapped, actionKey "/getAutoDatas" is already in use.
at com.jfinal.core.ActionMapping.buildActionMapping(ActionMapping.java:101)
at com.jfinal.core.JFinal.initActionMapping(JFinal.java:104)
at com.jfinal.core.JFinal.init(JFinal.java:68)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)

举报
顶部