Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compilation error

 
Ambika Jain
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting the following error in my jsp, for the following piece of code.
Also, using application.getInitParameter("admim") works fine. But I want
to know the meaning of this error.

-CODE-------------------------------------------------------------------------------------------
String admin=getServletContext.getInitParameter("admim");

-ERROR------------------------------------------------------------------------------------------
error.jsp:12:33: The qualifier of this name is a package, which cannot contain methods.
String admin=getServletContext.getInitParameter("admim");
^--------------^
------------------------------------------------------------------------------------------------
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clue: what is getServletContext? A variable? A method?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amba,

Its a method. I hope you knew it but forgot to put "()" after the name. If not read the docs.

cheers.
 
Vijay Sharma
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amba,
I think getServletContext() is a method.So,if u write
getServletContext().getInitParameter("Admin");
It should work fine.Just try this out.And if it works.Let me know also.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic