Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is javabean should be in package?

 
yamini nadella
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a javabean with no package and kept in WEB-INF/classes folder. from JSP I am calling as

<jsp:useBean id="counter" class="AccessCountBean" scope="application">

it is giving error as unknown class....etc.

if I put script in a package xyz, place it in WEB-INF/classes/xyz/ and called it from JSP as class="xyz.AccessCountBean" then it is working.

So is it mean javabean should have package.
 
phenix java
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you must import AccessCountBean to jsp too
<%@page import = "AccessCountBean"%>
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using beans from the default package will infuse your JSP documents with a multitude of compilation errors. Put the darn thing in a real package, please!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic