Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

1.4 Add java files


May 14, 2021 JFinal manual



Create a demo package under the project src directory and a demoConfig file under the demo package, as follows:

package demo;

import com.jfinal.config.*;

public class DemoConfig extends JFinalConfig {

public void configConstant(Constants me)

{ me.setDevMode(true);

}

public void configRoute(Routes me)

{ me.add("/hello",

HelloController.class);

}

public void configPlugin(Plugins me) {}

public void configInterceptor(Interceptors me) {}

public void configHandler(Handlers me) {}


Note: DemoConfig.java the package in which the file is located and its own file name must be consistent with the configuration in the param-value label in web.xml (in this case, the configuration is demo. DemoConfig)。


Create a HelloController class file under the demo package, as follows:

package demo;

import com.jfinal.core.Controller;

public class HelloController extends Controller {

public void index()

{ renderText("Hello JFinal

World.");

}