This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Basic useBean question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Basic useBean question" Watch "Basic useBean question" New topic
Author

Basic useBean question

Billy Hause
Greenhorn

Joined: Jan 16, 2002
Posts: 25
I put this at the top of my JSP
<jsp:useBean id="userInfo" scope="session" type="hause.user_management.User"/>
Now I get the following error:
javax.servlet.ServletException: bean userInfo not found within scope
What causes this error? (This is the first time I've tried to use the useBean tag in my jsps.)
Thanks,
Billy Hause
Jignesh Malavia
Author
Ranch Hand

Joined: May 18, 2001
Posts: 81
Replace the type attribute with the class attribute as
<jsp:useBean id="userInfo" scope="session" class="hause.user_management.User"/>
The class attribute instructs the JSP engine to create a new instance of the specified class if an existing one is not found.
For a detailed explanation on the different attributes of the useBean tag, have a look at this chapter.
-j
Billy Hause
Greenhorn

Joined: Jan 16, 2002
Posts: 25
Thanks Much!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic useBean question
 
Similar Threads
value for useBean class is invalid
Using jsp:useBean across JSPs
Bean Trouble
javabeans problem
How to access Bean