• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP compiles only when called Class is in a package.  RSS feed

 
Arvind Mahendra
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to compile a JSP and I was calling the method of a class that was in the default package(ie:none). like so:
Connection conn=ConnectMe.connectIt();

And the error I was getting was:
[error]
MyJSP_jsp.java:116: cannot find symbol
symbol : variable ConnectMe
location: class org.apache.jsp.MyJsp_jsp
Connection conn=ConnectMe.connectIt();
[/error] ^


I know that it wasnt a classpath problem because when I would type ConnectMe and press '.' the method name would show up in netbeans code assist popup.

But when I put the ConnectMe class in a package. Then my JSP compiles fine.
Although its not a problem as such, Anyone know why this behaviour?
 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the way it works. You can check the FAQ here or the spec. Bottom any class referenced in your jsp must be in a package. Not the default package.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!