Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invoking methods present in jsp/servlet from another jsp/servlet

 
Pratibha Malhotra
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-> How can i invoke test() in a.jsp from calltest() in b.jsp

-> How can i invoke method present in one servlet from another servlet.
 
Ner min
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i would say u can't(if b.jsp is not included through a.jsp). Couse 2 different jsp r nothing else then two different classes. And on class have no ideea of the methods of onother. Think about takeing the method logic out in some other non-servlet-helper class/been and the instantiate the class from the jsp and call the method.

If u need just some data, use setAttribute("whatever") in apropriate scope a.jsp and call it via getAttribute("whatever")
 
Pratibha Malhotra
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But eventually jsp's turn into servlets.
Can't we invoke method present in one servlet from another servlet
 
Ner min
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im also new to to servlets but the java-inside-me says - no!
the servlet is just a class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic