can v create a constructor 4 servlet?

Answer Posted / sanjay sah

Yes, we can create constructor for servlet but that one
should be public no-args constructor.
If we do not create then compiler itself takes care for
it.Servlet container creates instance of servlet by invoking
public no-agrs constructor.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is new in ServletRequest interface ? (Servlet 2.4)

578


Why is init() method is used in servlets?

558


How can you use a servlet to generate a plain text instead of html?

597


What are the different ways we can maintain state between requests?

580


What is the difference between servlet and jsp?

602






What is the disadvantage of cookies?

580


what is multiple server?

1763


What are the differences between forward() method and sendredirect() methods?

553


Which interface should be implemented by all servlets?

702


Explain the custom jsp tags and the beans.

617


Difference between get and post in java servlets?

550


Should I override the service() method?

670


What are the different methods of session management in servlets?

542


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!

1838


Explain servlet events?

566