File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes class in jsp useBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "class in jsp useBean" Watch "class in jsp useBean" New topic

class in jsp useBean

sangeeta kapoor
Ranch Hand

Joined: Jun 15, 2004
Posts: 70
Why does the import attribute of page directive does not work for <jsp:useBean>

I was importing a class using

<%@ page import = "beans.Person" %>

so I guessed i'd only have to do

<jsp:useBean id="person" class="Person" scope="request" />

but it gave me an error. I had to use the fully qualified name in the class property of <jsp:useBean> tag

<jsp:useBean id="person" class="beans.Person" scope="request" />

Why doesn't the page directive work here?
Mohammad Miazi

Joined: Sep 09, 2004
Posts: 10
That comes from jsp spec.
for <jsp:useBean>, class and type must be fully qualified path .

i.e class="package.class" | type="package.class"
melan hen

Joined: Feb 14, 2005
Posts: 17
JSP v2.0 Spec Pg. 1-104, Table JSP.5-1
The fully qualified name of the class that defines the implementation of the object.The class name is case sensitive.

SCJP 1.2 (88%)<br />SCWCD 1.4 (89%)<br />SCBCD (in progress)<br />SCEA (in progress)
I agree. Here's the link:
subject: class in jsp useBean
It's not a secret anymore!