wood burning stoves 2.0*
The moose likes JSP and the fly likes JSP init() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP init() method" Watch "JSP init() method" New topic
Author

JSP init() method

Santosh Kumar Nayak
Ranch Hand

Joined: Aug 02, 2011
Posts: 95
In a web based project where there are many JSP files then in such scenario how to make out as which JSP file will have the init() method ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42365
    
  64
That's an odd question; what is the underlying problem that prompted it?


Ping & DNS - my free Android networking tools app
Alex Theedom
Ranch Hand

Joined: Jan 18, 2012
Posts: 48

JSPs are translated to servlet code and each JSP servlet has its own jspInit() method which is analogous to the init() method in a servlet.

Perhaps you are asking about application wide parameters in which case you can set these parameters as a <context-param> for the entire web application in the web.xml file.


Alex Theedom - Senior Java EE Developer (OCPJP/OCPJWCD)
Santosh Kumar Nayak
Ranch Hand

Joined: Aug 02, 2011
Posts: 95
The purpose of asking the same was that I wanted to find out the point where init() is invoked.

now as mentioned above as each servlets will have it own init() method hence my doubt is clear.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

Santosh Kumar Nayak wrote:The purpose of asking the same was that I wanted to find out the point where init() is invoked.

That does not answer the question.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Balaji Vankadaru
Ranch Hand

Joined: May 31, 2013
Posts: 47

one_jsp.java created by the tomcat server.





one.jsp


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Hello this is Balaji
</body>
</html>
Balaji Vankadaru
Ranch Hand

Joined: May 31, 2013
Posts: 47
lets have you have ten different pages. Ten different java class files would be created.

Each jsp page serves its own purpose.

But the communication between jsp's can be achieved tough trough include, forward ,sendredirect mechanisms.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP init() method