GTU WTAD Practical 21 : Create a Java class called Product with the following properties: name, description, price. Create a listener that notifies (through System.out) whenever a user adds a product to a shopping cart (i.e. adds an object to the session object) or removes it again. Hint: check out the class HttpSessionAttributeListener. Make it print the name and price of the object (hint: access the session through the HttpBindingEvent object). Also, let the listener print the total price of all objects saved in the session so far (one way to accomplish this could be to keep a collection of all objects saved to the session – or just their keys – in the listener or an associated class).

GTU WTAD Practical 21 : Create a Java class called Product with the following properties: name, description, price.  Create a listener that notifies (through System.out) whenever a user adds a product to a shopping cart (i.e. adds an object to the session object) or removes it again. Hint: check out the class HttpSessionAttributeListener. Make it print the name and price of the object (hint: access the session through the HttpBindingEvent object). Also, let the listener print the total price of all objects saved in the session so far (one way to accomplish this could be to keep a collection of all objects saved to the session  –  or just their keys  –  in the listener or an associated class).

GTU WTAD Practical 21 :   Create a Java class called Product with the following properties: name, description, price.  Create a listener that notifies

File Name : index.jsp

File Location : Tomcat_Apache\webapps\gtu_21\

 

File Name : product.java

File Location : Tomcat_Apache\webapps\gtu_21\WEB-INF\classes

 

File Name : web.xml

File Location : Tomcat_Apache\webapps\gtu_21\WEB-INF

 

Output : 1

GTU WTAD Practical 21 :   Create a Java class called Product with the following properties: name, description, price.  Create a listener that notifies

Output : 2

GTU WTAD Practical 21 :   Create a Java class called Product with the following properties: name, description, price.  Create a listener that notifies

Adarsh Patel

My Self Adarsh Suryakant Patel. Currently I am working as Assistant Professor at Parul Instiute of Engineering and Technology, MCA Department, Limda, Vadodara. Major Responsibility : * Lectures * Organizing Training and Expert Sessions for * Placement and Recruitment * Faculty Representative