HTTP ERROR 404
Problem accessing /. Reason:
Not Found
Powered by Jetty:// 9.4.z-SNAPSHOT
web.xml 配置如下:
jfinalcom.jfinal.core.JFinalFilterconfigClasscom.demo.common.DemoConfigjfinal/*
com.demo.commoncom.demo.index.IndexControllercom.jfinal.config.Constantscom.jfinal.config.Handlerscom.jfinal.config.Interceptorscom.jfinal.config.JFinalConfigcom.jfinal.config.Pluginscom.jfinal.config.Routescom.jfinal.core.JFinalcom.jfinal.kit.Propcom.jfinal.kit.PropKitcom.jfinal.template.EngineDemoConfig JFinalConfig { Prop (String[] args) { JFinal.()} () { (== ) { = PropKit.()} } (Constants me) { ()me.setDevMode(.getBoolean())me.setInjectDependency()me.setInjectSuperClass()} (Routes me) { me.add(IndexController.)} (Engine me) { } (Plugins me) { } (Interceptors me) { } (Handlers me) { } }
com.demo.indexcom.jfinal.core.ControllerIndexController Controller { () { renderText()} }
IDE 为 IntelliJ IDFEA 2019 ,JFinal 4.3 , jetty 启用
根据提示,应该是程序根本就没有调用 com.demo.common.DemoConfig , 不清楚是什么地方没配置对? 希望专家给予指导,谢谢,
项目:JFinal
HTTP ERROR 404
Problem accessing /. Reason:
Not Found
Powered by Jetty:// 9.4.z-SNAPSHOT
下面是代码信息
web.xml 配置如下:
< filter >
< filter-name >jfinal< /filter-name>
< filter-class >com.jfinal.core.JFinalFilter
< init-param >
< param-name > configClass < /param-name>
< param-value >com.demo.common.DemoConfig< /param-value >
< filter-mapping >
< filter-name > jfinal < /filter-name >
< url-pattern >/*
-----------------------------------------
com.demo.common.DemoConfig 代码如下:
-----------------------------------------
package com.demo.common;
import com.demo.index.IndexController;
import com.jfinal.config.Constants;
import com.jfinal.config.Handlers;
import com.jfinal.config.Interceptors;
import com.jfinal.config.JFinalConfig;
import com.jfinal.config.Plugins;
import com.jfinal.config.Routes;
import com.jfinal.core.JFinal;
import com.jfinal.kit.Prop;
import com.jfinal.kit.PropKit;
import com.jfinal.template.Engine;
public class DemoConfig extends JFinalConfig {
static Prop p;
public static void main(String[] args) {
JFinal.start("WebRoot", 80, "/");
}
static void loadConfig() {
if (p == null) {
p = PropKit.useFirstFound("demo-config-pro.txt", "demo-config-dev.txt");
}
}
public void configConstant(Constants me) {
loadConfig();
me.setDevMode(p.getBoolean("devMode", false));
me.setInjectDependency(true);
me.setInjectSuperClass(true);
}
/**
* 配置路由
*/
public void configRoute(Routes me) {
me.add("/", IndexController.class, "/index"); // 第三个参数为该Controller的视图存放路径
}
public void configEngine(Engine me) {
}
public void configPlugin(Plugins me) {
}
public void configInterceptor(Interceptors me) {
}
public void configHandler(Handlers me) {
}
}
-----------------------------------------
IndexController 代码如下:
-----------------------------------------
package com.demo.index;
import com.jfinal.core.Controller;
public class IndexController extends Controller {
public void index() {
renderText(" hello OK ");
}
}
IDE 为 IntelliJ IDFEA 2019 ,JFinal 4.3 , jetty 启用
根据提示,应该是程序根本就没有调用 com.demo.common.DemoConfig , 不清楚是什么地方没配置对? 希望专家给予指导,谢谢,