我用的是myeclipse6.5 tomcat5.5,好像tomcat5.0以上都支持jstl。
我也是找了很多资料,尝试了好多办法,包括改jsp版本,下载包,修改web.xml等,后来可以了,但是改的地方很多,后来尝试把一些修改的地方还原回来,还可以,最后只是按第一种方法就可以了。
法一:
jsp2.5
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
jsp2.4
<?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">
jsp2.4版本默认支持el表达式,但2,5默认关闭的
如果表达式不起作用,可以看一下jsp的版本。如果是2.5的,可以换成2.4试一下。
在Jsp页面中添加
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>这样一句话
这样就可以了(我是这样改的)
法二:
如果还不可以,可以尝试下载jstl包
在http://jakarta.apache.org/taglibs/index.html下载
jakarta-taglibs-standard-current.zip ,解压后,将tld文件夹里的.tld拷贝到web_inf下,把lib里的jtsl.jar和standard.jar拷到工程的lib文件夹下。
然后在jsp中
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
法三:
修改web.xml,加上下面的语句:
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/xml</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
</jsp-config>
JSP中导入<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>。
参考资料很多,有些没有记下来:如果没解决,可以看看这2个网页http://hi.baidu.com/yych13/blog/item/be00ea0985f05ec93ac76376.html