Question: (50 Marks) Structured Question Answer ALL TWO (2) questions. Write all your answers in the answer booklet. Question 3 (25 marks) a) JavaBean is an



(50 Marks) Structured Question Answer ALL TWO (2) questions. Write all your answers in the answer booklet. Question 3 (25 marks) a) JavaBean is an ordinary Java class that conforms to several rules. Describe THREE (3) of the rules. (3 marks) b) Program 3.1 shows an incomplete code for JavaBean class (Employee.java). Complete the code for JavaBean Employee which conforms with all the JavaBean rules. (6 marks) 7/Program 3.1: JavaBean Employee.java (answer for 03.b. i) package Model (answer for Q3.b.ii) public class private String employeeName; private int salary: (answer for Q3.b.iii) //constructor //getters & setters public void set EmployeeName (String employeeName) { this.employeeName = employeeName; public void setSalary(int salary) ( this.salary - salary: } (answer for 03.b. iv) }//end of JavaBean Employee c) Complete the code in pageSet.jsp, by using a JSP action elements syntax to create a bean object from class Employee in (b) with the following specifications and then forward the request to pageDisplay.jsp: bean name : employee employeeName: John Doe salary: 3500 bean scope: request (6 marks) //---complete your code for 3(c) here--- d) Complete the code in page Display.jsp, by using a JSP action elements syntax, to display the bean values that you have created in (c) above. (4 marks) //---complete your code for 3 (d) here--- e) Given the Program 3.2 (Appliance.java) and Program 3.3 (session.jsp). Change Program 3.3 which is using JSP scripting elements into JSP action clements. Complete the code in Program 3.4. (6 marks) // Program 3.2: Appliance.java package Model; public class Appliance implements Serializable private String name; private String brand; //the detail Javabean implementation is omitted for brevity 2 1 2 3 4 5 // Program 3.3 - session.jsp (Scripting elements) 7 8 Appliance app = new Appliance(); 9 app.setName ("Fridge"); 10 app.setBrand ("Samsung"); 11 12 session.setAttribute("appliances", app); 13 14 15 16 17 1 18
19 20 21 22 |
Appliance Name:
23
Brand :
24 25 26 27 1 // Program 3.4 - session.jsp 2 (Action elements) 3 4 5 6 7
8 9 10 11 12 // ---complete your code for 0.3(e) here--- 13 14 15 16 17 18 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
