Unit 4


Java applets- Life cycle of an applet – Adding images to an applet – Adding sound to an applet. Passing parameters to an applet. Event Handling. Introducing AWT: Working with Windows Graphics and Text. Using AWT Controls, Layout Managers and Menus. Servlet – life cycle of a servlet. The Servlet API, Handling HTTP Request and Response, using Cookies, Session Tracking. Introduction to JSP.

Part A

# Question
1 Define Java Applet.
2 What are AWT controls?
3 Define servlets
4 Define the use of ServletContext object.
5 List the use of cookies.
6 What is JSP? Write two main usages of it.
7 What are the advantages of event delegation model?
8 Discuss the two types of methods to run an applet.
9 What are the life cycle methods of servlets?
10 What are HttpServletRequest and HttpServletResponse?
11 Illustrate the life-cycle of an applet and its methods.
12 Illustrate the use of frames in layout management.
13 Classify the different types of directive in JSP?
14 How does radio button in Java differs from check box?
15 Compare JSP and servlet.
16 How do you manage the color and font of graphics in applet?
17 How sessions are handled in servlets
18 Code a graphics method in Java to draw the string �Hello World�
19 Formulate a JSP with simple java code to display a welcome
20 How to pass parameter to an applet?

Part B

# Question
1 (i) Describe in detail about the AWT Event classes. (7) (ii) Describe about the various Event Listeners(6)
2 (i) What is the function of layout manager? Describe in detail about the different layout in Java GUI. (7) (ii) With an example, define working with text in an applet.(6)
3 Enlist the methods that can be used to handle the HTTP request. (13)
4 (i) Write a client server JSP program to find simple interest and display the result in the client. (8) (ii) Define the JSP tag libraries. (5)
5 Discuss in detail about the HttpServlet Class and its interface. (13)
6 Discuss in detail about AWT event hierarchy.(13)
7 (i) Discuss about servlet life cycle with example. (5) (ii) Discuss database connectivity with Servlet to display student marks.(8)
8 (i) With suitable example, explain the windows graphics. (6) (ii) Explain the working with text in an applet.(7)
9 (i) Explain with an example to add images to an applet.(4) (ii) Briefly explain with an example to add sound to an applet.(4) (iii) Explain how parameters are passed to an applet with an example.(5)
10 (i) Develop a JSP to accept user�s first name and then welcome the user by name. (7) (ii) Enlist the implicit objects that are used in JSP.(6)
11 (i) Illustrate in detail with an example the dynamic content generation by servlet. (7) (ii) Illustrate how java servlets perform session handling.(6)
12 (i) In an Applet, create a frame with two text fields and three buttons (Cut, Copy & Paste). Data entered in the first text field should respond, according to the buttons clicked. (8) (ii) Write a JavaServlet program to implement Cookies using getCookies(), getName() and getValue() methods.(5)
13 (i) Discuss the ways of storing, and accessing information using cookies and handling associated issues.(7) (ii) Write a code for creating cookies with name of person and secret code at the server, after getting these details from client using HTML form. How these details at the server side using Http servlet are displayed?(6)
14 Using AWT create a frame which contains four text fields name, age, sex and qualification layout using the flow layout manager. Run the program and give the values of all text fields in the command line. Initially all the values of text field should be blank. On clicking the click button all the text fields should contain the command line inputs.