I have a class product that contains the attribute name, description, and value.
My intention is to populate the products within the scope of my project. How do I get it?
Second, on popularizing products, I want to be able to display each product in a table in a JSP page. Each product will have its own table, its name, description, and value and the cart button must be added
I want to populate products in the application scope of my project. How do I get it?
So do you want to populate it once during the lifetime of the webapp? Use a
circactext listener .
@WebListener Public Class StartupListener applies ServletContextListener {@Override Public Zero Context Start (ServletContextEvent Event) {List & lt; Products & gt; Products = LoadIight (like); Event.getServletContext () SetAttribute ("product", product); } // ...}
In this way, the products
list & lt; Products & gt; Products = (list & lt; product & gt;) getServletContext (). GetAttribute ("Products");
and in each JSP
$ {products}
second When making products popular, I want to be able to display each product in a table in a JSP page. Each product will have its own table, its name, description, and price and an edition will be listed in the cart button
So would you like to categorize products?
list & lt; Category & gt; , where
class class
list
, or Maps & lt; String, list & lt; Products & gt; & Gt; Where the name of the class is
How to display it, it has already been given in your reply.
Comments
Post a Comment