在jsf1使用 taglib 定义 标签出现

The absolute uri: http://java.sun.com/jsf/core cannot be resolved in either web.xml or the jar files deployed with this application

的错误,后来修改成名称空间的方式就可以了

原因不明

<html xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
>

<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %> <%@ taglib prefix="mytag" uri="http://www.hantongchao.com/tag/mytag" %>
<!--
Created by IntelliJ IDEA.
User: han
Date: 14-2-26
Time: ����1:32
-->
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
//创建一个List对象
List<String> a = new ArrayList<String>();
a.add("hello");
a.add("world");
a.add("java");
//将List对象放入page范围内
pageContext.setAttribute("a" , a);
%>
<html xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
>
<head><title>Simple jsp page</title></head>
<body> <f:view >
<h:outputLabel value="Hello, world"/>
<mytag:date>time
<table border="1" bgcolor="aaaadd" width="300">
<tr>
<td>${pageScope.a}</td>
<td>${a}</td>
<tr>
</table>
</mytag:date>
</f:view> <table border="1" bgcolor="aaaadd" width="300">
<!-- 使用迭代器标签,对a集合进行迭代 -->
<mytag:iterator collection="a" item="item">
<tr>
<td>${pageScope.item}</td>
<tr> </mytag:iterator>
</table>
<%
//使用pageContext设置属性,该属性默认在page范围内
pageContext.setAttribute("page","hello");
//使用request设置属性,该属性默认在request范围内
request.setAttribute("request","hello");
//使用pageContext将属性设置在request范围中
pageContext.setAttribute("request2","hello"
, pageContext.REQUEST_SCOPE);
//使用session将属性设置在session范围中
session.setAttribute("session","hello");
//使用pageContext将属性设置在session范围中
pageContext.setAttribute("session2","hello"
, pageContext.SESSION_SCOPE);
//使用application将属性设置在application范围中
application.setAttribute("app","hello");
//使用pageContext将属性设置在application范围中
pageContext.setAttribute("app2","hello"
, pageContext.APPLICATION_SCOPE);
//下面获取各属性所在的范围:
out.println("page变量所在范围:" +
pageContext.getAttributesScope("page") + "<br>");
out.println("request变量所在范围:" +
pageContext.getAttributesScope("request") + "<br>");
out.println("request2变量所在范围:"+
pageContext.getAttributesScope("request2") + "<br>");
out.println("session变量所在范围:" +
pageContext.getAttributesScope("session") + "<br>");
out.println("session2变量所在范围:" +
pageContext.getAttributesScope("session2") + "<br>");
out.println("app变量所在范围:" +
pageContext.getAttributesScope("app") + "<br>");
out.println("app2变量所在范围:" +
pageContext.getAttributesScope("app2") + "<br>");
%>
</body>
</html>

  

JSF2 下 taglib 的问题的更多相关文章

  1. JSP 自定义标签

    0 标签技术的API继承体系 1 作用 jsp自定义标签用于移除页面中的java代码 2 实现 2.1 标签处理类ViewIPTag.java package com.zsm.util; import ...

  2. 表达式语句(EL)

    EL的基本语法 ${expression} Expression:制定要输出的变了或字符串.或EL运算符组成的表达式. 禁用EL表达式: 1. 使用“\”符号禁用. \${expression} 2. ...

  3. C++程序结构---1

    C++ 基础教程Beta 版 原作:Juan Soulié 翻译:Jing Xu (aqua) 英文原版 本教程根据Juan Soulie的英文版C++教程翻译并改编. 本版为最新校对版,尚未定稿.如 ...

  4. [转]Eclipse下开发Struts奇怪异常:org.apache.struts.taglib.bean.CookieTei

    今天早上开始在Eclipse下学习struts,于是按照李兴华老师的<struts入门视频教程>一步一步地充满快乐的学习,等把登陆程序写完,打开浏览器准备运行的时候,奇怪的异常产生了,异常 ...

  5. idea下的jsp开发中cannot resolve taglib with uri的解决方法

    写jsp难免会用到<c:foreach>标签,于是我在idea上的jsp顶头写下了 <%@ taglib prefix="c" uri= 'http://java ...

  6. [JSP]自定义标签库taglib

    自定义标签的步骤 自定义标签的步骤大概有三步: 1.继承javax.servlet.jsp.tagext.*下提供的几个标签类,如Tag.TagSupport.BodyTagSupport.Simpl ...

  7. Myeclipse下的struts2.3.8 配置 保证绝对好用

    转自:http://blog.csdn.net/oxuannishi/article/details/8538386 1.建立web project工程,我的结构如下: 2.这一步非常重要:引入必要的 ...

  8. 杂谈 Taglib、EL、OGNL

    本篇主要是自己对 JavaWeb中 EL.OGNL.Taglib 个人理解. 因为以上内容都是在 JSP 的基础下产生的概念, 首先得说说我眼中的 JSP. 她自由的.奔放的,就像辽阔的大海,跨越任何 ...

  9. 【Java EE 学习 35 下】【struts2】【struts2文件上传】【struts2自定义拦截器】【struts2手动验证】

    一.struts2文件上传 1.上传文件的时候要求必须使得表单的enctype属性设置为multipart/form-data,把它的method属性设置为post 2.上传单个文件的时候需要在Act ...

随机推荐

  1. JSBinding / Home

    Description JSBinding is a tool enabling you to run actual javascript in Unity3D. It contains Mozill ...

  2. 20151217JS便签

    JS便签: 根据一个数值来改变Repeater行数的颜色 <script type="text/javascript"> var query = document.ge ...

  3. 第三节:视图(Views)和模板(Templates)

    目录 概览 编写视图 编辑视图实际做一些事情 抛出404异常 使用模板系统 移除在代码中的硬编码网址 Url名称的命名空间 概览 视图是Django应用的网页的“类型”,一般服务于特定的功能并且有特定 ...

  4. Spring webapp - shutting down threads on Application stop

    显示使用线程池Executors,必须执行 pool.shutdown() 否则会存在线程池泄露: http://stackoverflow.com/questions/22650569/spring ...

  5. knockout 学习实例5 style

    <!DOCTYPE html><html><head> <meta charset="utf-8"> <title>&l ...

  6. 使用-MM生成include指令和依赖生成(make include directive and dependency generation with -MM)

    I want a build rule to be triggered by an include directive if the target of the include is out of d ...

  7. 黄聪:PHP解决textarea内容换行存入数据库,如何解析取出不能自动换行

    解决办法: <textarea rows="5" style="height: auto;" ><?php //按行分割,然后每行输出后带上一 ...

  8. 使用C#对SQLLite进行操作

    1.数据库连接(常用连接方法,示例) 1). 添加引用: System.Data.SQLite.DLL .2). 打开或创建数据库文件: SQLiteConnection.CreateFile(fil ...

  9. Codeforces Round #378 (Div. 2) D - Kostya the Sculptor

    Kostya the Sculptor 这次cf打的又是心累啊,果然我太菜,真的该认真学习,不要随便的浪费时间啦 [题目链接]Kostya the Sculptor &题意: 给你n个长方体, ...

  10. [Tex学习笔记]一个数学公式

    \begin{equation*} \begin{aligned} &\quad\int |\nabla(T_1-\overline{T})^+|^2 \rm dx-\int \frac{3m ...