I have problem using jstl tag in jsp file. Basically I should make this as 2 questions although they are related.
But if I changed to use the older namespace,
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>. others are not changed, then the if tag is working, because the message inside the if tag is shown.
That can happen if you have a standard.jar of JSTL 1.0 in the /WEB-INF/lib. Get rid of it. See also our JSTL wiki page. I by the way assume that you've untouched Tomcat's and JRE's own /lib folders and have not dropped any JSTL-related JARs in there, or have extracted the JSTL JAR's contents in a careless attempt to solve the problem.
By the way, I am using servlet 2.5, jsp 2.0, jstl 1.2. I did try to upgrade the jsp2.0 to jsp2.1 in order to see if I can fix the first problem, but I have no idea how to upgrade jsp version. I am very new to programming.
You should absolutely not provide any Servlet or JSP libraries in /WEB-INF/lib yourself. The servlet container (in your case, Tomcat) already ships with it. See also How do I import the javax.servlet API in my Eclipse project?
You only need to make sure that your web.xml root declaration complies whatever your servlet container supports. Tomcat 7 is a Servlet 3.0 compatible container, so your web.xml root declaration should look like this: