参考:

cannot load JSTL taglib within embedded Jetty server:http://stackoverflow.com/questions/2151075/cannot-load-jstl-taglib-within-embedded-jetty-server

How do you get embedded Jetty 9 to successfully resolve the JSTL URI?: http://stackoverflow.com/questions/17685330/how-do-you-get-embedded-jetty-9-to-successfully-resolve-the-jstl-uri​;

JSTL核心标签使用:http://www.cnblogs.com/lihuiyy/archive/2012/02/24/2366806.html

JSP表达式语言:http://blog.csdn.net/csuliky/article/details/2452207
Using Spring3.2 MVC with embedded jetty9:http://stackoverflow.com/questions/19169377/using-spring3-2-mvc-with-embedded-jetty9

1. 简述

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" isELIgnored="false" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

上述异常在tomcat等地方只需要在页面上添加相应的语句即可解决。但是这里使用的嵌入式Jetty时还是会出现上述问题。

在jetty启动前添加上面的代码。问题原因是Jetty无法加载JSTL类库。这是一个bug

2. Jetty依赖

<dependency>

<groupId>org.eclipse.jetty</groupId>

<artifactId>jetty-webapp</artifactId>

<version>9.0.7.v20131107</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>org.eclipse.jetty</groupId>

<artifactId>jetty-servlet</artifactId>

<version>9.0.7.v20131107</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>org.eclipse.jetty</groupId>

<artifactId>jetty-jsp</artifactId>

<version>9.0.7.v20131107</version>

</dependency>

3. 运行代码

public class JettyServer {

public static void main(String[] args) throws Exception {

System.setProperty("DWPROJECTNO", "resource");

System.setProperty("DWENV", "dev");

startJettyServer(80, "/");

}

/**

* 创建用于正常运行调试的Jetty Server, 以src/main/webapp为Web应用目录.

*

* @throws Exception

*/

public static void startJettyServer(int port, String contextPath) throws Exception {

/* fix jetty8.x, jetty 9.x can't load jstl library */

Field f = TldScanner.class.getDeclaredField("systemUris");

f.setAccessible(true);

((Set<?>) f.get(null)).clear();

f.setAccessible(false);

Server server = new Server(port);

WebAppContext webContext = new WebAppContext("src/main/webapp", contextPath);

webContext.setClassLoader(Thread.currentThread().getContextClassLoader());

webContext.setDefaultsDescriptor("src/test/resources/jetty-webdefault.xml");

server.setHandler(webContext);

server.setStopAtShutdown(true);

server.start();

server.join();

}

}

jetty 8.x, 9.x无法加载jstl的PWC6188问题的更多相关文章

  1. jetty 8.x, 9.x无法加载jstl的PWC6188问题,jstlpwc6188

    jetty 8.x, 9.x无法加载jstl的PWC6188问题,jstlpwc6188 来源:互联网编辑:李秀媚评论:发表评论字号: S M L jetty 8.x, 9.x无法加载jstl的PWC ...

  2. 最简单的操作 jetty IDEA 【debug】热加载

    [博客园cnblogs笔者m-yb原创,转载请加本文博客链接,笔者github: https://github.com/mayangbo666,公众号aandb7,QQ群927113708] http ...

  3. idea加载JSTL库

    被这个错误缠了很长时间,偶然解决.eclipse for EE里导入JSTL没有问题,在JetIdea里就报classnotfound的异常. 解决方案:打包方式fix一下 新建library fil ...

  4. jetty加载spring-context容器源码分析

    带着疑问开始 web.xml的顺序问题 先拿一个最简单的spring mvc web.xml来说问题,如下图:如果我将三者的顺序倒置或是乱置,会产生什么结果呢? 启动报错?还是加载未知结果?还是毫无影 ...

  5. 【技术贴】第二篇 :解决使用maven jetty启动后无法加载修改过后的静态资源

    之前写过第一篇:[技术贴]解决使用maven jetty启动后无法加载修改过后的静态资源 一直用着挺舒服的,直到今天,出现了又不能修改静态js,jsp等资源的现象.很是苦闷. 经过调错处理之后,发现是 ...

  6. jetty9内嵌到应用,并在启动后加载WebApplicationInitializer,可运行jsp

    声明:本文所介绍的两功能都已经测试通过. 第一步先确保你用的是java 8,并依赖需要的相关jar包,以下是用gradle进行依赖的信息: ext { taglibsStandardVersion = ...

  7. ContextLoaderListener加载过程

    在web.xml中,配置ContextLoaderListener <!-- 配置Listener,用来创建Spring容器 --> <listener> <listen ...

  8. Spring boot加载REACTIVE源码分析

    一,加载REACTIVE相关自动配置 spring boot通过判断含org.springframework.web.reactive.DispatcherHandler字节文件就确定程序类型是REA ...

  9. 几种优化web页面加载速度的策略

    剥离静态资源请求到CDN 一般在主域名下的HTTP请求里都会携带大量Cookie信息,最大4KB,每个域名下最多50条:但如果仅仅访问js/css/jpeg等静态资源文件的话是不需要Cookie信息, ...

随机推荐

  1. codeforces 678D D. Iterated Linear Function(水题)

    题目链接: D. Iterated Linear Function time limit per test 1 second memory limit per test 256 megabytes i ...

  2. hdu-5714 拍照(二分)

    题目链接: 拍照 Time Limit: 6000/3000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others) Proble ...

  3. IOS APP圆形图片的实现

    //设置圆形cornerRadius,是宽或高的一半 _imageView.layer.masksToBounds = YES; CGFloat w = _imageView.frame.size.w ...

  4. Hartree-Fock理论(更新中)

    预备知识: 基组 分子轨道基本概念与Hartree Product 平均场与Fock算符 在忽略分子中电子的相互作用时,我们有了一个粗糙的模型,虽然非常容易求解,但是描述的精确程度非常差. 考虑电子的 ...

  5. html5 之 canvas 相关知识(二)API-fillStyle

    颜色.样式和阴影 fillStyle 设置或返回用于填充绘画的颜色.渐变或模式 定义和用法 context.fillStyle=color|gradient|pattern;//指示绘图填充色的CSS ...

  6. 【ANT】Ant常用的内置task

    ant 例如: <target name="callProjectB"> <echo message="In projectA calling proj ...

  7. 【转载】MQTT学习笔记——MQTT协议体验 Mosquitto安装和使用

    http://blog.csdn.net/xukai871105/article/details/39252653 0 前言     MQTT是IBM开发的一个即时通讯协议.MQTT是面向M2M和物联 ...

  8. Part 56 Generics in C#

     

  9. 从ASP.NET的web1子界面刷新打开web1的web0父界面

    单击web0界面的按钮bt1触发一下代码: protected void btnSave_Click(object sender, EventArgs e) { string parentJs = @ ...

  10. jQuery之DOM操作

    对于DOM的认知,我们了解多少? DOM是Document Object Model的缩写,意思是文档对象模型,是由W3C制定的一套访问和操作XML(eXtensible Markup Languag ...