<%@ taglib prefix="c" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page contentType="text/html; charset=gb2312" language="java"%><jsp:useBean id="now" class="java.util.Date"/>
<fmt:setLocale value="zh-cn"/><%@page import="java.util.*"%>
<html>
<head>
<title>JSTL:这里是一个简单的JSTL应用</title></head>
<body bgcolor="#FFFFFF">
<h3>这里是一个简单的JSTL应用</h3>
<%
Collection customers=new ArrayList();
customers.add(new String("guest1"));
customers.add(new String("guest2"));
customers.add(new String("guest3"));
request.setAttribute("customers",customers);
%>
<h4>Customers in the request:</h4>
<c:set var="customer" scope="session" value="${requestScope.customers}"/>
<c:forEach var="customer" items="${customers}">
<c:out value="${customer}"/><br>
</c:forEach>
<br>
现在的时间是:
<br>
<fmt:timeZone value="GMT">
<fmt:formatDate value="${now}" type="both" dateStyle="full" timeStyle="full"/>
</fmt:timeZone></body></html>用myeclipse
老提示Multiple annotations found at this line:
- Unknown tag (c:set).
- Unknown tag (c:set).Collection is a raw type. References to generic type Collection<E> should be parameterized
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page contentType="text/html; charset=gb2312" language="java"%><jsp:useBean id="now" class="java.util.Date"/>
<fmt:setLocale value="zh-cn"/><%@page import="java.util.*"%>
<html>
<head>
<title>JSTL:这里是一个简单的JSTL应用</title></head>
<body bgcolor="#FFFFFF">
<h3>这里是一个简单的JSTL应用</h3>
<%
Collection customers=new ArrayList();
customers.add(new String("guest1"));
customers.add(new String("guest2"));
customers.add(new String("guest3"));
request.setAttribute("customers",customers);
%>
<h4>Customers in the request:</h4>
<c:set var="customer" scope="session" value="${requestScope.customers}"/>
<c:forEach var="customer" items="${customers}">
<c:out value="${customer}"/><br>
</c:forEach>
<br>
现在的时间是:
<br>
<fmt:timeZone value="GMT">
<fmt:formatDate value="${now}" type="both" dateStyle="full" timeStyle="full"/>
</fmt:timeZone></body></html>用myeclipse
老提示Multiple annotations found at this line:
- Unknown tag (c:set).
- Unknown tag (c:set).Collection is a raw type. References to generic type Collection<E> should be parameterized
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:420)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:476)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1426)
org.apache.jasper.compiler.Parser.parse(Parser.java:133)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.
换上试试 你那个是jsf
标签库写的也不对,<%@taglib ....>不能有空格
myeclipse 9.0HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:420)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:476)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1426)
org.apache.jasper.compiler.Parser.parse(Parser.java:133)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.
--------------------------------------------------------------------------------
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
另外还要导入jstl.jar和standard.jar