• 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!
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!