刚开始用玩JFinal,用IDEA+Tomcat跑项目没问题,由于改任何jsp页面上的文字都需要重新启动tomcat才可以刷新过来,觉得麻烦,就换成JFinal整合Jetty启动项目,但是一直报错,实在解决不了,大家帮忙看看是哪里的问题。
开发环境:IDEA JDK1.8
web.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> <filter> <filter-name>jfinal</filter-name> <filter-class>com.jfinal.core.JFinalFilter</filter-class> <init-param> <param-name>configClass</param-name> <param-value>com.jfinaltest.common.MainConfig</param-value> </init-param> </filter> <filter-mapping> <filter-name>jfinal</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.jfinal</groupId> <artifactId>jfinaltest</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>jfinaltest Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <!--jfinal--> <dependency> <groupId>com.jfinal</groupId> <artifactId>jfinal</artifactId> <version>3.2</version> </dependency> <!-- https://mvnrepository.com/artifact/org.eclipse.jetty.orbit/javax.servlet.jsp.jstl --> <dependency> <groupId>org.eclipse.jetty.orbit</groupId> <artifactId>javax.servlet.jsp.jstl</artifactId> <version>1.2.0.v201105211821</version> </dependency> <!-- https://mvnrepository.com/artifact/org.eclipse.jetty.orbit/org.apache.taglibs.standard.glassfish --> <dependency> <groupId>org.eclipse.jetty.orbit</groupId> <artifactId>org.apache.taglibs.standard.glassfish</artifactId> <version>1.2.0.v201112081803</version> </dependency> <dependency> <groupId>com.jfinal</groupId> <artifactId>jetty-server</artifactId> <version>8.1.8</version> </dependency> </dependencies> <build> <finalName>jfinaltest</finalName> </build> </project>
MainConfig
package com.jfinaltest.common; import com.jfinal.config.*; import com.jfinal.core.JFinal; import com.jfinal.render.ViewType; import com.jfinal.template.Engine; import com.jfinaltest.controller.HelloController; /** * Created by guoxi on 2017/8/27. */ public class MainConfig extends JFinalConfig { public void configConstant(Constants me) { me.setDevMode(true); me.setViewType(ViewType.JSP); } public void configRoute(Routes me) { me.add("/", HelloController.class); } public void configEngine(Engine me) { } public void configPlugin(Plugins me) { } public void configInterceptor(Interceptors me) { } public void configHandler(Handlers me) { } public static void main(String[] args) { JFinal.start("src/main/webapp",80,"/"); } }
HelloController
package com.jfinaltest.controller; import com.jfinal.core.Controller; /** * Created by guoxi on 2017/8/27. */ public class HelloController extends Controller { public void index(){ render("index.jsp"); } }
现在我直接运行项目,报这个错误