aspose file tools*
The moose likes JSP and the fly likes JSTL/core with Tomcat 7 is giving HTTP Status 404  error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL/core with Tomcat 7 is giving HTTP Status 404  error" Watch "JSTL/core with Tomcat 7 is giving HTTP Status 404  error" New topic
Author

JSTL/core with Tomcat 7 is giving HTTP Status 404 error

vani patel
Greenhorn

Joined: Aug 27, 2011
Posts: 4
Hi i new to JSTL and am tring one example code is given below demo2.jsp and my server is Tomcat 7 ,your any help would be appriciated, i added below jar files in build path
core-3.1.1.jar
jsp.2.1.jar
jsp-api.jar
jsp-api-2.1.jar
jstl-1.2.jar
servlet-api.jar

and when i run this jsp file i am getting below error, i tried other files without jstl it is working fine

demo2.jsp

`<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<html>
<body>
<form method=post action="demo2.jsp">
<jsp:useBean id="bean1" class="ourbeans.player">
<jsp:setProperty name="bean1" property="*" />
</jsp:useBean>
Name <input type=text name="name"><br>
Place<input type=text name="place"><br>
Game<input type=text name="game"><br>
<input type=submit>
</form>

Name: <c:out value="${bean1.name}" /><br>
Place: <c:out value="${bean1.place}" /><br>
Game: <c:out value="${bean1.game}" />
</body>
</html>
`
// player.java `package ourbeans;




public class player{
String name;
String place;
String game;
public player(){
name=" ";
place=" ";
game=" ";
}
//---------------------------

public void setName(String a){
name=a;
}

public void setPlace(String b){
place=b;
}

public void setGame(String c){
game=c;
}
//------------------------------

public String getName(){
return name;
}

public String getPlace(){
return place;
}

public String getGame(){
return game;
}

}
`
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61191
    
  66

Did you put the jstl-1.2.jar in WEB-INF/lib?

(Note: do not copy any of the other jars to WEB-INF/lib, only the JSTL jar)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
vani patel
Greenhorn

Joined: Aug 27, 2011
Posts: 4
Yes i did put below jars in WEB-INF/lib folder and then added in build path
core-3.1.1.jar
jsp.2.1.jar
jsp-api.jar
jsp-api-2.1.jar
jstl-1.2.jar
servlet-api.jar

Shall i remove all other jar files from lib and from build path except jstl-1.2.jar?

btw thanks for answering
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61191
    
  66

No one said anything about the build path. All the jars need to be on the build path.

WEB-INF/lib has nothing to do with the build path. It's what is used at run time. The build path is meaningless at run time.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61191
    
  66

vani patel wrote:Yes i did put below jars in WEB-INF/lib folder

Remove them. All but the JSTL jar.

Putting those other ars in WEB-INF/lib will cause no end of class loader problems. Tomcat supplies those files at run-time.
vani patel
Greenhorn

Joined: Aug 27, 2011
Posts: 4
i tried removing all other jars except jstl-1.2.jar in WEB-INF/lib and even from the build path but i am gettign still same error
HTTP Status 404 - /1/

--------------------------------------------------------------------------------

type Status report

message /1/

description The requested resource is not available.


--------------------------------------------------------------------------------

Apache Tomcat/7.0.35

Can you please help me if possible as i am stuck at the first stage to learn JSTL
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
I would suggest to start simply.

#1: Get a "Hello world" JSP page to display with just static text, and nothing else. Here is one of the basic diagnostic pages I use regularly:



#2: Add an EL expression to the page to ensure that works

should produce "2 + 2 = 4"

#3: Add JSTL library and a JSTL tag




NOTE: you have been using the OLD uri for JSTL. Make sure you use the new one like in the example here.
(Note the subtle addition of the "/jsp" in the middle of it)

Sagar Vyas
Greenhorn

Joined: Feb 17, 2013
Posts: 10
vani patel wrote:Hi i new to JSTL and am tring one example code is given below demo2.jsp and my server is Tomcat 7 ,your any help would be appriciated, i added below jar files in build path
core-3.1.1.jar
jsp.2.1.jar
jsp-api.jar
jsp-api-2.1.jar
jstl-1.2.jar
servlet-api.jar

and when i run this jsp file i am getting below error, i tried other files without jstl it is working fine

demo2.jsp

`<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>



Hi Vani,

Can you please try with following ?

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

HTH.

Thanks,
Sagar Vyas

Sagar Vyas
"More Sharing and More Learning"
vani patel
Greenhorn

Joined: Aug 27, 2011
Posts: 4
Thanks Stefan and Sagar for your help.

I could solve the problem by doing fresh start and updating URI with adding JSP, actually i did tried with new URL too but that time it did not worked,

But now with only one JSTL jar and new URI it is working fine, this was my first question and could solve problem so thanks for now and future for more questions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL/core with Tomcat 7 is giving HTTP Status 404 error