I am learning how to use jsp and beans now, and can't understand what the issue I'm having.
I am trying to create a bean like this: ...
and am getting the error:
java.lang.InstantiationException: bean reservation not found within scope
I have looked around online, and most people seem to recommend using class="..." instead of type="...", or using an import statement. I am already doing the former and tried the latter...any ideas?
This is the bean:
package homework10;
public class Reservation {
private int groupSize;
private String status;
private double cost;
private boolean triedAndFailed;
public Reservation(){
}
public void setGroupSize(int gs)
{
groupSize = gs;
}
public int getGroupSize()
{
return groupSize;
}
public void setStatus(String str)
{
this.status = str;
}
public String getStatus()
{
return status;
}
public void setCost(double cost)
{
this.cost = cost;
}
public double getCost()
{
return cost;
}
public void setTriedAndFailed(boolean bool)
{
this.triedAndFailed = bool;
}
public boolean isTriedAndFailed()
{
return triedAndFailed;
}
}
and this is the beginning of the jsp page:
<head>
<!--<script type="text/javascript" src="functions8.js">
</script>-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BHC Calculator-HTML-validation + Servlet Version</title>
<jsp:useBean id = "reservation" class = "homework10.Reservation" scope = "session" />
</head>
Thanks in advance!