Hi guys.. Well can u tell me that why there is need of
"init()" , i mean why can not we initialize the servlet object
with the help of constructors?
Thank you.
Answer Posted / manas banerjee
you can use but should not.the original reason for init()
was that ancient version of java could not dynamically
invoke constructors with arguments.so there was no way to
give the constructors a ServletConfig.So u would not have
to access to ServletConfig or ServletContext.
{{in short:init() has access to servletconfig and
servletcontext object constructor would not..
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What if you need to span your transaction across multiple servlet invocations?
what do you understand by url rewriting?
Is java servlet still used?
How can you run a servlet program?
What is the use of httpservletrequestwrapper?
what is servlet chaining?
How do you deal property files in servlet?
How to rectify errors in java servlet while compilation?
What is the use of httpservletresponsewrapper?
Can you explain in detail 'javax.servlet' package?
What is the use of request dispatcher interface?
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!
Explains the differences between context.getrequestdispatcher() and request.getrequestdispatcher()?
What are the advantages of cookies?
What are the kinds of http requests?