Meaningless Drivel is fun!*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Action to be done in init - JSP" Watch "Action to be done in init - JSP" New topic
Author

Action to be done in init - JSP

Jeraldine Sheeba
Greenhorn

Joined: Sep 10, 2004
Posts: 8
Hi,

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
Thanks,
sheeba
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
Greenhorn

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
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Why didn't you include the text of the compiler error? We can't read your mind?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Action to be done in init - JSP
 
Similar Threads
regarding constructor in servlet
config parameters for JSP
security related
Tips to create web forum in JSF
Execute javascript in servlet