[problems running this code

[nobr]hello all. i am trying to run a simple example which consist of a servlet, jsp and a java file. i am using eclipse. For some reason when i try to run my jsp file in eclipse the output in the browser displays that

type Status report

message /ProductServlet/ex.jsp

description The requested resource (/ProductServlet/ex.jsp) is not available.

http://localhost:8080/chapter4/ProductServlet/ex.jsp

I am running in eclipse builtin browser.

here is my simple easy looking Product code with getter and setter methods

Product.java

package chapter5;

publicclass Product{

private String name =null;

privatedouble price = 0.0d;

public String getName( ){

return name;

}

publicvoid setName(String name){

this.name = name;

}

publicdouble getPrice( ){

return price;

}

publicvoid setPrice(double price){

this.price = price;

}

}

Here is my ProductServlet

package chapter5;

import javax.servlet.http.*;

import javax.servlet.ServletException;

import java.io.IOException;

publicclass ProductServletextends HttpServlet{

protectedvoid doGet(HttpServletRequest request,

HttpServletResponse response)

throws ServletException, IOException{

Product product =new Product( );

product.setName("Hyperwidget");

product.setPrice(599.99d);

request.setAttribute("product", product);

request.getRequestDispatcher("chapter4/ex.jsp")

.forward(request, response);

}

}

and here is my ex.jsp

<html>

<body>

<%

java.util.Date theDate =new java.util.Date( );

%>

<%if (theDate.getHours( ) < 12){ %>

Good morning,

<%}else{ %>

Good afternoon,

<%} %>

visitor. It is now <%= theDate.toString( ) %>

<br>

Is three greater than four? That's ${3 > 4}.

The sum is ${3+4}, though.

<h1>${product.name}</h1>

Price: $${product.price}

</body>

</html>

Can someone point out what am i doing wrong?[/nobr]

[4008 byte] By [schumachera] at [2007-11-27 8:21:58]
# 1
Search this forum, "The requested resource is not available". You will get lot of search results and it would be helpful for you.
skp71a at 2007-7-12 20:10:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

My Problem is not running a servlet program or a jsp program. I can run Servlet and jsp programs both in eclipse. The only problem i am having is with the requestdispatcher thing. I have a java bean class product and productservlet class which have a doGet method and a jsp which is where i am having problem in order to call the object which is product and print out its elements.

regards

schumachera at 2007-7-12 20:10:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...