aspose file tools*
The moose likes Servlets and the fly likes writing the user defined function in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

writing the user defined function in servlet

srinivasan tkvsn
Greenhorn

Joined: Jul 17, 2006
Posts: 2
hai;

i am writing a servlet using doGet(). In this doGet() method can i
write a user dfined which will be calling another ...based on some condition.
could any body show me the way please..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39544
    
  27
A servlet is a regular Java class. It can contain other methods besides the ones defined in the Servlet interface, and those methods can be called from doGet/doPost. Does that answer your question?
[ July 17, 2006: Message edited by: Ulf Dittmer ]

Ping & DNS - updated with new look and Ping home screen widget
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by srinivasan tkvsn:
hai;

... In this doGet() method can i
write a user dfined


You can not nest methods in Java (without going through some contortions).
You can write your own methods can call them from the doGet method.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
shilpa deshmukh-kadam
Ranch Hand

Joined: Jun 01, 2012
Posts: 38
Ben Souther wrote:


You can not nest methods in Java (without going through some contortions).
You can write your own methods can call them from the doGet method.


I get errors while creating my own method and I want to call my own method into anather servlet can you help me please my code is as below


Thank you
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

@shilpa This is 10 year old thread. Please take care while posting your questions. I am sure that you would not like to wake the zombies. I also did the same mistake when I posted my first question here and I am still waiting for the reply. Hope you will not like to happen the same with you. Start a new thread.


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: writing the user defined function in servlet
 
Similar Threads
How to invoke a servlet
is other method also synchronized
Http Request Type in Servlet
Confusion in Mock exam qn
Where is doGet() in JSF?