• 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

Constructor,init() in a servlet

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,
I am new to the development.Any one of you please clear my doubts..

1)What will happen if i create a contrutor to my servlet?
2) can i creata thread in service method and can i use it ?
3) How to call a user difined method in one servlet from another servelt?
4)init() method is called only once,but there r two overloaded init methods,which one will be called when servlet is loaded?
5)why should i go to EJB if i can write my business logic using servlets itself?
6) how to use the filter when server is sending response to the clinet?

ThankYou.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DurgaKrishna,
Welcome to JavaRanch!

We're pleased to have you here with us in the JSP forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here

Also:
n an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular, please see CarefullyChooseOneForum.

This forum is dedicated to JSP issues.
I'll move your thread to the Servlets forum for you.

Again, welcome to JavaRanch and good luck with your question.
-Ben
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1)What will happen if i create a contrutor to my servlet?
** the servlet container will always call a no-args constructor, there is no good reason to do this - instead, follow the servlet API and use init

2) can i creata thread in service method and can i use it ?
** sure, just be careful - there have been many discussions of when this might be desirable, (not very often) do a search in this forum.

3) How to call a user difined method in one servlet from another servelt?
** This would be a bad design, keep your servlet code simple and put useful methods in helper classes.

4)init() method is called only once,but there r two overloaded init methods,which one will be called when servlet is loaded?
** use one or the other, not both in your servlet code

5)why should i go to EJB if i can write my business logic using servlets itself?
** no good reason to use EJB if you dont have to.

6) how to use the filter when server is sending response to the clinet?
** read the JavaDocs for filters

Bill
 
Durga Krishna
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ThankYou bill..
I got very perfect answers from you i think.Thankyou very much
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"DurgaKrishna", you have previously been warned on multiple occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional, and this is your final warning. Adjust your display name to comply with the required standards prior to your next post.

Failure to comply will result in the removal of your account.

bear
JavaRanch Sheriff
 
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic