I am trying to use a javaBean with Tomcat 4.1.27. I can not get it to work by following the instructions on page 78 of the Beginning JSP Web Development book released in 2001. I think the instructions are outdated.
Could someone please explain to me where I should save the CarBean.java file if I make it part of the package com.wrox.cars;
I will be invoking it from the following web page at url:
http://localhost:8080/begjsp-ch04/carPage.jsp.
Here is carPage.jsp:
<html>
<head>
<title>Using a JavaBean</title>
</head>
<body>
<h2>Using a JavaBean</h2>
<% com.wrox.cars.CarBean myCar = new com.wrox.cars.CarBean(); %>
I own a <%= myCar.getMake() %> <br />
<% myCar.setMake("Porche"); %>
Now I own a <%= myCar.getMake()%>
<br>
</body>
</html>
Here is CarBean.java:
package com.wrox.cars;
import java.io.Serializable;
public class CarBean implements Serializable{
public CarBean(){
}
private String make = "Ford";
public String getMake(){
return make;
}
public void setMake(String make){
this.make = make;
}
}