参考:

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. IE浏览器部分版本不支持background-siza属性问题

    background-size是CSS3新增的属性,但是IE8以下还是不支持,可以通过滤镜来实现这样的一个效果 background-size:contain; // 缩小图片来适应元素的尺寸(保持像 ...

  2. 怒刷DP之 HDU 1176

    免费馅饼 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status  ...

  3. BZOJ 2879: [Noi2012]美食节 最小费用流 动态添边

    2879: [Noi2012]美食节 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 324  Solved: 179[Submit][Status] ...

  4. MongoDB - Introduction to MongoDB, MongoDB Extended JSON

    JSON can only represent a subset of the types supported by BSON. To preserve type information, Mongo ...

  5. TransmitFile下载文件(部分转载)

    例子代码: public void Down() { TransmitFile(@"/File/KBPub.zip"); } public void TransmitFile(st ...

  6. Android OpenGL ES(一)----必备知识

    1.手机的坐标空间 我们都知道要想在手机上随心所欲的绘制图形,就必须了解手机的坐标体系.下图就是将坐标映射到手机屏幕的坐标. 图1手机屏幕基本坐标系 2.OpenGL基本图形 在OpenGL里,只能绘 ...

  7. Cannot find protocol declaration for "XXDelegate" 找不到协议错误

    原因是 在A里面继承了B类里面的"XXDelegate",在B类的头文件里又导入了A类的头文件 解决方法 不在B类的头文件导入A类的头文件,改成在B类的.m文件导入A类的头文件

  8. PC上面的蓝牙的通信(C#)

    添加引用InTheHand.Net.Personal.dll 首先创建一个蓝牙类 class LanYa { public string blueName { get; set; } //l蓝牙名字 ...

  9. springside出现Description Resource Path Location Type

    <?xml version="1.0" encoding="utf-8" ?><beans xmlns="http://www.sp ...

  10. JS学习笔记 -- 定时器,提示框的应用

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...