• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Constructor,init() in a servlet

 
Durga Krishna
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
ThankYou bill..
I got very perfect answers from you i think.Thankyou very much
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic