Why can not find the index.jsp in the web project with DD

All, Forgive me I am the newbie in the Java web world, I am trying to write a web project for a test. But seems I didn't got the result I expected. I don't know what happen to it . Please help to review it .Here is what I done so far.

  1. Create a dynamic web project named MyFirstWeb in the Eclipse with the option Generate web.xml DD.
  2. Add a index.jsp under the directory of WebContent.below is the page code in it.
<%@ 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>My Title</title>
</head>
<body>
<% java.util.Date d = new java.util.Date(); %>
<h1>
Today's date is <%= d.toString() %> and this jsp page worked!
</h1>
</body>
</html>

And after I published it to the build-in Tomcat server run-time in the Eclipse. There is no error when the server is started. But I got a empty page for the url http://localhost:8080/MyFirstWeb/index.jsp, Why? thanks.

Answers


Well I used your exact code in Eclipse and it is working perfectly fine. can you post what the error is.? And check if your web.xml has this

<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>MyFirstWeb</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

Add to your web.xml

<welcome-file-list>
   <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

Need Your Help

sql foreign keys

sql table foreign-keys phpmyadmin foreign-key-relationship

I was create tables with the syntax in phpmyadmin:

multilevel menu with multilevel array

php arrays menu

just want to ask anyone here can solve this problem?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.