How to make servlet thread safe?
Answer Posted / sanjay
to make servlet as threas safe we have three approaches
1.do not instance variables into our servlet we use only
local variables
2.by using synchronized methods
3.synchronized blocks
above three ways synchronized blocks is the best way
Is This Answer Correct ? | 12 Yes | 1 No |
Post New Answer View All Answers
What is servlet lazy loading?
What do you mean by scope object and what are its types?
What's the use of servletcontext?
When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet?
What is the use of send redirect () method?
What do you mean by servlet context?
What is the advantage of Servlets when compared with other server side technologies?
If some new data has entered the database, explain how can a servlet refresh automatically?
What is http servlet? Explain with the help of an example.
What are all the protocols supported by httpservlet?
Hello, My project requirement is like I need to create a web page using MVC pattern. I hava a bean class, jsp page, servlet, service and dao. My jsp has two fields. One is dropdown list. The option values has to get populated from the database table. The other one is a text box and its value has to come from database table. As of now I have defined the fields in bean class, got the values from database using arraylists in dao class and I called this from service class. Can anyone please tell me the workflow of how the servlet will get this arraylist and populate the arraylist values as dropdown options in jsp page? Also I would like to know the role of bean class in MVC pattern? Thanks in advance!
What is the life-cycle of servlets?
How do cookies work in servlets?
What is ServletConfig object?
What is the difference between servlet and jsp?