why do we need jsp:useBean???
843833Jul 5 2001 — edited Jul 7 2001Hi 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