This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes Action to be done in init - JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "Action to be done in init - JSP" Watch "Action to be done in init - JSP" New topic

Action to be done in init - JSP

Jeraldine Sheeba

Joined: Sep 10, 2004
Posts: 8

I have to get a HashMap from a java file into a JSP Page and the specification adds that it should be done once (i.e., that it is in init of a JSP,there is no servlet to do it.)Can we write override init() of a JSP page and how should I do it?

Please suggest me a method ASAP
rahul V kumar
Ranch Hand

Joined: May 20, 2003
Posts: 82
I am not sure what you are trying to do. but there are jspInit() and jspDestory() methods that you could use.

Could you please specify what you are doing
Jeraldine Sheeba

Joined: Sep 10, 2004
Posts: 8
To be more clear I need to overide the jspInit of a JSP Page...

Can u show a sample page where I can write some functionality within jspInit?

<!-- Imported beans -->

public void jspInit() {

Map actionsMap = new HashMap();
//class which has the hashmap returning function
ActionsHandler actionsHandler = new ActionsHandler();
actionsMap = actionsHandler.getActionMap();
This shows compiler error.
How to do this?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13000
Why didn't you include the text of the compiler error? We can't read your mind?
I agree. Here's the link:
subject: Action to be done in init - JSP
It's not a secret anymore!