File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes problem using javabean in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "problem using javabean in JSP" Watch "problem using javabean in JSP" New topic

problem using javabean in JSP

swapna Kadali

Joined: Oct 06, 2003
Posts: 22
Hi everbody!
I have used JavaBean as arraylist and hardcoded some values in the servlet. I am now trying to show those JavaBean values through JSP to the user. my code in JSP is:
<jsp:useBean id="qb" class="QuoteBean"/>
// I think default scope=page, so didnt mention
<jsp:setProperty name="qb" property="*"/>
When I execute JSP page, the error i get is : QuoteBean qb = null.
Can anybody pls help figuring out the problem.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286

Most Application Servers don't like Beans that are not packaged. So it could be a couple of things.
1. You need to put your bean in a package (ie. com.mypackage.QuoteBean)
2. You have your bean in a package but you failed to list it that way in the JSP tag. You tag would look like:

[ October 19, 2003: Message edited by: Gregg Bolinger ]

GenRocket - A Test Data Generation Platform
James Zhang
Ranch Hand

Joined: Sep 06, 2002
Posts: 30
Gregg, thanks a lot for your valuable advice! It solved my problem!
I agree. Here's the link:
subject: problem using javabean in JSP
Similar Threads
Why does my JSP looses JavaBean values!
how to keep some variable in different Jsp Pages
Using JSP with servlets
JavaBeans and Servlets
How to pass drop down box value to a bean