jetty 8.x, 9.x无法加载jstl的PWC6188问题
参考:
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问题的更多相关文章
- 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 ...
- 最简单的操作 jetty IDEA 【debug】热加载
[博客园cnblogs笔者m-yb原创,转载请加本文博客链接,笔者github: https://github.com/mayangbo666,公众号aandb7,QQ群927113708] http ...
- idea加载JSTL库
被这个错误缠了很长时间,偶然解决.eclipse for EE里导入JSTL没有问题,在JetIdea里就报classnotfound的异常. 解决方案:打包方式fix一下 新建library fil ...
- jetty加载spring-context容器源码分析
带着疑问开始 web.xml的顺序问题 先拿一个最简单的spring mvc web.xml来说问题,如下图:如果我将三者的顺序倒置或是乱置,会产生什么结果呢? 启动报错?还是加载未知结果?还是毫无影 ...
- 【技术贴】第二篇 :解决使用maven jetty启动后无法加载修改过后的静态资源
之前写过第一篇:[技术贴]解决使用maven jetty启动后无法加载修改过后的静态资源 一直用着挺舒服的,直到今天,出现了又不能修改静态js,jsp等资源的现象.很是苦闷. 经过调错处理之后,发现是 ...
- jetty9内嵌到应用,并在启动后加载WebApplicationInitializer,可运行jsp
声明:本文所介绍的两功能都已经测试通过. 第一步先确保你用的是java 8,并依赖需要的相关jar包,以下是用gradle进行依赖的信息: ext { taglibsStandardVersion = ...
- ContextLoaderListener加载过程
在web.xml中,配置ContextLoaderListener <!-- 配置Listener,用来创建Spring容器 --> <listener> <listen ...
- Spring boot加载REACTIVE源码分析
一,加载REACTIVE相关自动配置 spring boot通过判断含org.springframework.web.reactive.DispatcherHandler字节文件就确定程序类型是REA ...
- 几种优化web页面加载速度的策略
剥离静态资源请求到CDN 一般在主域名下的HTTP请求里都会携带大量Cookie信息,最大4KB,每个域名下最多50条:但如果仅仅访问js/css/jpeg等静态资源文件的话是不需要Cookie信息, ...
随机推荐
- 20145102 《Java程序设计》第1周学习总结
20145102 <Java程序设计>第1周学习总结 教材学习内容总结 linux下对于java的安装是非常简便的,只要参照ArchWiki就可以快速安装,没有Windows上那么复杂.I ...
- CF Set of Strings
Set of Strings time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- SVN管理规范
命名规范 tags 正式版 REL-X.X.X branches 发版前 RB-X.X.X 新功能 TRY-XXX 修BUG BUG-XXXX trunk 开发 使用注意事项 负责而谨慎地提交自己的代 ...
- 转: 视频相关的协议族介绍(rtsp, hls, rtmp)
转自: http://www.zhihu.com/question/20621558 作者:杨华链接:http://www.zhihu.com/question/20621558/answer/1 ...
- 分页控件(PageControl)的相关属性说明
UIPageControl *pageControl = [[UIPageControl alloc] init]; pageControl.center = CGPointMake(w * ); p ...
- Part 1 some difference from asp.net to asp.net mvc4
Part 1 some difference from asp.net to asp.net mvc4 In MVC URL's are mapped to controller Action Met ...
- iOS开发那些事-iOS6苹果地图实用开发
在iOS 6之后,不再使用谷歌地图了,而是使用苹果自己的地图,但是API编程接口没有太大的变化.开发人员不需要再学习很多新东西就能开发地图应用,这是负责任的做法.因此本节介绍的内容也同样适用于iOS5 ...
- UIAlertView[警告框] [代理协议型]UIActionSheet [表单视图][代理协议型]
//// ViewController.h// UIAlertViewAndUIActionSheet//// Created by hehe on 15/9/21.// Copyright ...
- Python3 - 时间处理与定时任务
1.计算明天和昨天的日期 #! /usr/bin/env python #coding=utf-8 # 获取今天.昨天和明天的日期 # 引入datetime模块 import datetime #计算 ...
- mysql 存储过程详解 存储过程
mysql存储过程详解 1. 存储过程简介 我们常用的操作数据库语言SQL语句在执行的时候需要要先编译,然后执行,而存储过程(Stored Procedure)是一组为了完成 ...