aspose file tools*
The moose likes JSP and the fly likes method to return a map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "method to return a map" Watch "method to return a map" New topic
Author

method to return a map

liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
I have this simple code in my jsp page and I'm getting an error
"Syntax error on token "(", ; expected"
where the method starts. I can't see what I'm doing wrong. Can someone please look at this?

if(ownerID != null){
HashMap mapOwner = getContact(ownerID);
}
private HashMap getContact(String id){
HashMap mapContact = new HashMap();

return mapContact;
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Just like with "normal" Java, you can't just declare a method in the middle of another one.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
Thanks a lot. I didn't realize the method was inside an if statement.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: method to return a map