Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<c:out/> unknown tag

Why I get error tip message in eclipse on left when I include the following line.

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

I get the error "Unknown tag(c:out)"

I also included on top

<%@ page isELIgnored ="false" %> 

Is there a jstl I need to include?

like image 834
Some Java Guy Avatar asked Dec 06 '11 13:12

Some Java Guy


People also ask

What is c out in HTML?

c:out is a tag used to display the result of an expression in the web browser, which works similarly to the way JSP's <%=... %> expression tag works. The only difference is that this tag helps avoid HTML characters so that you can avoid cross-site scripting.

What is the use of c Remove tag?

The <c:remove> tag removes a variable from either a specified scope or the first scope where the variable is found (if no scope is specified). This action is not particularly helpful, but it can aid in ensuring that a JSP cleans up any scoped resources it is responsible for.

What is c set tag?

The <c:set> tag is JSTL-friendly version of the setProperty action. The tag is helpful because it evaluates an expression and uses the results to set a value of a JavaBean or a java. util. Map object.

What is full form of JSTL?

The Jakarta Standard Tag Library (JSTL; formerly JavaServer Pages Standard Tag Library) is a component of the Java EE Web application development platform.


1 Answers

You're apparently developing with a servlet container which does not support JSTL out the box, such as Tomcat. In that case, you need to download jstl-1.2.jar and drop in /WEB-INF/lib folder of your webapp. 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.

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:

<%@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. 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).

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)
like image 56
BalusC Avatar answered Nov 09 '22 22:11

BalusC