cannot load JSTL taglib within embedded Jetty server

后端 未结 10 780
太阳男子
太阳男子 2020-12-10 11:55

I am writing a web application that runs within an embedded Jetty instance.

When I attempt to execute a JSTL statement, I receive the following exception:

10条回答
  •  春和景丽
    2020-12-10 12:55

    Two step:

    1)add annotation support for the server

    //Enable parsing of jndi-related parts of web.xml and jetty-env.xml, #server is

    org.eclipse.jetty.webapp.Configuration.ClassList classlist = org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
    classlist.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration", "org.eclipse.jetty.plus.webapp.EnvConfiguration", "org.eclipse.jetty.plus.webapp.PlusConfiguration");
    classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.annotations.AnnotationConfiguration");
    

    2) add the follow attribute to the WebAppContext

    context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/org.apache.taglibs.taglibs-standard-impl-.*\\.jar$");
    

提交回复
热议问题