JSF2 下 taglib 的問題

來源:互聯網
上載者:User

標籤:c   class   blog   java   ext   http   

在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>

  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.