(Tomcat, JSP, and Javabean) finding beans
843835Dec 27 2002 — edited Dec 28 2002Hi everyone,
I am wondering if anyone can shed some light on tomcat, jsp, and javabean. The problem I am having is quite typical, but yet I am still unable to figure out what to do. All I want to do is to see if a javabean works in JSP pages, so i write a simple bean like this one and it is located in $catalina/webapp/root/web-inf/class/ :
import java.io.*;
public class simplebean implements Serializable
{
private String name;
public void setname(String s)
{
name=s;
}
public String getname()
{
return name;
}
}
I also have a JSP page in the $catalina/webapp/root directory and have named index.jsp, so that I can see the page on the browser with the url(http://localhost:8080):
<%@ page language="java" %>
<jsp:useBean id="test" scope="page" class="simplebean"></jsp:useBean>
<html>
<body>
hello
</body>
</html>
This is basically everything I have. As you can see my bean(class file) is in the right place and my jsp is in the right place, so wha is really wrong.
Can anyone tell if there is any configuration on tomcat to locate the bean? How does tomcat or JSP locate the bean? where does it look? Is there any configuration on server.xml or web.xml? thank you if anyone can provide some insight.