• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP compiles only when called Class is in a package.

 
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, see:
http://faq.javaranch.com/java/PackageYourBeans
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic