Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

why do we need jsp:useBean???

843833Jul 5 2001 — edited Jul 7 2001
Hi All,

I am going over both the J2EE tutorial and JSP1.2 spec.

As far as I read, it seems to me that "jsp:useBean" is a way of creating a bean object.
<jsp:useBean id="local" scope="application" class="Mylocales">

If I put the class file in the import statement, can I create the object in the scriptlet

<% Mylocales local = new Mylocales(); %>

and set/get properties by calling

local.setName(); // assume these methods are in the class
local.getName();

without using "jsp:setProperty" and "jsp:getProperty".In this way, isn't it a redundancy to have "jsp:useBean" in JSP spec? We can always create any kind of objects in the scriptlets.

Since "jsp:useBean" has been there for years, I believe something must be wrong with my rationale. However, both the spec and the tutorial couldn't answer this question. Can anyone clear it up to me?

Thx in advance.

Kevin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 4 2001
Added on Jul 5 2001
7 comments
536 views