Can we write a constructor for a Servlet class ? if yes how ?
if no why not ?
Answer Posted / chandra
constructor required, but it should be public no-argument
constructor. even though if you are not write that
constructor java compiler will create that construtctor by
default. for that your servlet class should be public other
wise you will get RuntimeWxception saying RequestedResource
is not available like that.
| Is This Answer Correct ? | 9 Yes | 2 No |
Post New Answer View All Answers
What are the disadvantages of storing session state in cookies?
What’s the difference between sendredirect and forward methods
Which method of the httpservletrequest object is used?
What is cgi and what are its drawbacks?
Define the servlet mapping.
Define declaration.
Is java servlet still used?
What is load-on-startup in servlet?
How does Cookies work in Servlets?
What do you mean by session tracking and also explain its techniques?
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 are important features of Servlet 3?
What is cookie in servlet?
What do you mean by request dispatcher in servlet? Also explain its methods.
What are the difference between session and cookies in servlet? Explain