• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class in jsp useBean

 
sangeeta kapoor
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP v2.0 Spec Pg. 1-104, Table JSP.5-1
...
Class
The fully qualified name of the class that defines the implementation of the object.The class name is case sensitive.
...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic