I have been stuck up with running hello world program in JSP.When i start my server it showing resource not found exception. please help me to solve this problem. I have mentioned my code below
index.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>MySample</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
From comments above you had placed file in wrong folder.
Put your index.jsp
file inside WebContent
folder. Do not put in WEB-INF
folder.
- The mandatory location of all Web resources, including HTML, JSP, graphic files, and so on.
- If the files are not placed in this directory (or in a subdirectory structure under this directory), the files will not be available when the application is executed on a server.
- The Web content folder represents the contents of the WAR file that will be deployed to the server. Any files not under the Web content folder are considered development-time resources (for example, .java files, .sql files, and .mif files), and are not deployed when the project is unit tested or published.
Your Welcome index file should start with "/index.jsp" starting with slash if it is directly inside WebContent directory. If it is inside some dirctory like JSP it should be like /JSP/index.jsp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With