Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP init() method

 
Santosh Kumar Nayak
Ranch Hand
Posts: 143
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's an odd question; what is the underlying problem that prompted it?
 
Alex Theedom
Author
Ranch Hand
Posts: 77
5
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Santosh Kumar Nayak
Ranch Hand
Posts: 143
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Balaji Vankadaru
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic