tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Stacy <>
Subject Re: servlet question
Date Fri, 14 Apr 2000 17:28:45 GMT
>>>>> On Thu, 13 Apr 2000 17:39:55 -0500, Jeff Neuenschwander ("Jeff") writes:
 Jeff> In JSP, you do this to use a bean
 Jeff> <%@ page import="package.beanname" %>
 Jeff> <jsp:useBean id="myBean" scope="page" class="package.beanname" />
 Jeff> then you refer to the bean as myBean and do whatever you want to with it..
 Jeff> but in a servlet, I can't get it to work properly.  I am doing an
 Jeff> import beanname;
 Jeff> but do I need something like the useBean syntax in JSP?  I am guessing that
 Jeff> is my problem, but I can't find the correct command.

Please forgive me if I am misunderstanding your question.

The jsp:useBean action element instantiates a bean, so the corresponding
JAVA code in a servlet would be a constructor call ("new" statement);
you store the bean in a variable and do like bean.getFoo("bar") on it.

When compiling your code, there are the usual package and CLASSPATH issues,
some of which have been discussed here earlier today.

View raw message