简体   繁体   English

<c:out/>未知标签

[英]<c:out/> unknown tag

Why I get error tip message in eclipse on left when I include the following line.当我包含以下行时,为什么我在左侧的 eclipse 中收到错误提示消息。

<c:out value=${variable}/>

I get the error "Unknown tag(c:out)"我收到错误“未知标签(c:out)”

I also included on top我也包括在顶部

<%@ page isELIgnored ="false" %> 

Is there a jstl I need to include?我需要包含一个jstl吗?

You're apparently developing with a servlet container which does not support JSTL out the box, such as Tomcat.您显然正在使用不支持开箱即用的 JSTL 的 servlet 容器(例如 Tomcat)进行开发。 In that case, you need to download jstl-1.2.jar and drop in /WEB-INF/lib folder of your webapp.在这种情况下,您需要下载jstl-1.2.jar并将其放入您的 web 应用程序的/WEB-INF/lib文件夹中。 No other changes are necessary, also not extracting the JAR file and/or littering the /WEB-INF folder with loose TLD files as some poor online tutorials suggest.不需要其他更改,也不需要像一些糟糕的在线教程建议的那样提取 JAR 文件和/或用松散的 TLD 文件乱扔/WEB-INF文件夹。

After having dropped the JAR file in the classpath (the /WEB-INF/lib folder is part of the webapp's runtime classpath), you should be able to reference the JSTL core taglib by putting the following line in top of your JSP as per its documentation :有后放弃了JAR文件中的类路径(在/WEB-INF/lib文件夹是Web应用程序的运行时类路径的一部分),你应该能够通过将下面一行在你的JSP的顶部,每引用JSTL核心标签库其文档

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

JSTL 1.2 requires a minimum of Servlet 2.4 declaration in web.xml . JSTL 1.2 至少需要在web.xml声明 Servlet 2.4。 So make sure that your web.xml has the proper root declaration, preferably the highest supported version as supported by your servlet container (Tomcat 7 is Servlet 3.0, Tomcat 6 is Servlet 2.5 and Tomcat 5.5 is Servlet 2.4).因此,请确保您的web.xml具有正确的根声明,最好是您的 servlet 容器支持的最高支持版本(Tomcat 7 是 Servlet 3.0,Tomcat 6 是 Servlet 2.5,Tomcat 5.5 是 Servlet 2.4)。

See also:也可以看看:

  • Our JSTL tag wiki page (you can get to this page by putting your mouse above the [jstl] tag which you put on the question yourself and clicking the info link on the popbox)我们的 JSTL 标签 wiki 页面(您可以通过将鼠标放在您自己放置在问题上的 [jstl [jstl]标签上方并单击弹出框上的信息链接来访问此页面)

According to BalusC answer i downloaded the jstl jar and pasted it in lib folder and included the tag on top of my jsp page but still i am geeting the same issue unknown tag c:out .Please.answer ....... 根据BalusC的回答,我下载了jstl jar,并将其粘贴到lib文件夹中,并将该标签包括在我的jsp页面顶部,但是我仍然遇到相同的问题,未知标签c:out。 在此处输入图片说明

I am studying Spring Framework Security tutorial.我正在学习 Spring Framework Security 教程。 I imported a maven tutorial project, compiled and saw the warning "<c:out> unknown tag".我导入了一个 maven 教程项目,编译并看到警告“<c:out> unknown tag”。 The jstl-1.2.jar was already on the project class path. jstl-1.2.jar 已经在项目类路径上。 The problem was that the project came with 1.6 run time library, and I have only 1.7 installed on my machine.问题是该项目带有 1.6 运行时库,而我的机器上只安装了 1.7。 I replaced the libraries and it solved the problem.我更换了库,它解决了问题。

Add the given line on top of the JSP file:在 JSP 文件的顶部添加给定的行:

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

And, one more thing you need to do is, Copy the dependency from this maven repo link & paste it on pom.xml of the project.而且,您还需要做的另一件事是,从这个maven repo 链接复制依赖项并将其粘贴到项目的pom.xml上。

You need to include a link for the JSTL Library on that page.您需要在该页面上包含 JSTL 库的链接。 This tutorial should provide you with the necessary information. 教程应为您提供必要的信息。

I faced same issue during practice coding with jsp.我在用 jsp 练习编码时遇到了同样的问题。 Following worked for me - (In short)以下为我工作 - (简而言之)

Use jstl 1.2.jar in place of jstl.jar with:使用jstl 1.2.jar代替jstl.jar

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM