日期:2014-05-18  浏览次数:20696 次

刚学jsp,问一下标志库的问题。
<%@   taglib   prefix= "c "   uri= "http://java.sun.com/jsp/jstl/core "   %>
<html>
  <c:choose>
        <c:when   test= "${param.portchoice   ==   'news '} ">
            <head> <title> News   Portal </title> </head>
            <body>
              <h1> Welcome   to   the   News   Portal! </h1>      
            </body>
        </c:when>
        <c:when   test= "${param.portchoice   ==   'weather '} ">
              <head> <title> Weather   Portal </title> </head>
              <body>
                <h1> You   Get   the   Latest   Weather! </h1>      
              </body>
        </c:when>
        <c:when   test= "${param.portchoice   ==   'entertainment '} ">
              <head> <title> Entertainment   Portal </title> </head>
              <body>
              <h1> Entertainment   News   Just   for   You! </h1>      
              </body>
        </c:when>
        <c:otherwise>
              <head> <title> System   Portal </title> </head>
              <body>
              <h1> Application   logic   problem   detected! </h1>      
              </body>
        </c:otherwise>
</c:choose>
</html> 上面的代码使用了标志库,请问uri= "http://java.sun.com/jsp/jstl/core "是什么意思,是不是可以随便乱写的,还是有什么规定的?

------解决方案--------------------
需要和web.xml里声明的uri一样
------解决方案--------------------
<%@ taglib prefix= "c " uri= "http://java.sun.com/jsp/jstl/core " %>
这个是表示加载JSP 2.0的标准标签库中的核心标签库,里面的prefix值可以改,但是不推荐,后面uri里的写法是固定的.
标准标签库中还有其他的标签
<%@ taglib prefix= "sql " uri= "http://java.sun.com/jsp/jstl/sql " %>
导入标准标签库的SQL标签库.
<%@ taglib prefix= "fmt " uri= "http://java.sun.com/jsp/jstl/fmt " %>
国际标准化库
.........