• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
im also new to to servlets but the java-inside-me says - no!
the servlet is just a class.
reply
    Bookmark Topic Watch Topic
  • New Topic