Topic: 关于web.xml配置的问题

  Print this page

1.关于web.xml配置的问题 Copy to clipboard
Posted by: zjh1983314
Posted on: 2005-11-21 13:16

在网上找了一些资料配置了web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>My Web Application</display-name>
<description>
A application for test.
</description>
</web-app>
可以运行
<html><body><center>
Now time is: <%=new java.util.Date()%>
</center></body></html>
在JSP设计里看到的第一个程序:
<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>JSP is Easy</title>
</head>
<body bgcolor="white">

<h1>JSP is as easy as ...</h1>

<%-- Calculate the sum of 1 + 2 + 3 dynamically --%>
1 + 2 + 3 = <c:out value="${1 + 2 + 3}" />

</body>
</html>
不能运行。

把web.xml改成
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
</web-app>
就能运行了。有没有哪位大虾告诉我为什么!是不是因为<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>??谢谢!

2.Re:关于web.xml配置的问题 [Re: zjh1983314] Copy to clipboard
Posted by: bluepure
Posted on: 2005-11-21 16:20

http://java.sun.com/jsp/jstl/core
上面这个是2jstl1.1的声明

下面这个是2jstl1.0的声明:
http://java.sun.com/jstl/core


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923