0% found this document useful (0 votes)
12 views

Hibernate&struts 2

This Java class extends ActionSupport and contains code to retrieve and display a list of products from a database. It initializes a ProductDao object, defines getters and setters for the product list, and overrides the execute method to call the Dao to get the product list and return it, setting it as the action result.

Uploaded by

Fabiano Farah
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Hibernate&struts 2

This Java class extends ActionSupport and contains code to retrieve and display a list of products from a database. It initializes a ProductDao object, defines getters and setters for the product list, and overrides the execute method to call the Dao to get the product list and return it, setting it as the action result.

Uploaded by

Fabiano Farah
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ListProductController.

java

package br.struts2.controller.product;

import java.util.List;

public class ListProductController extends ActionSupport {

private static final long serialVersionUID = 1L;

ProductDao pruductDao = new ProductDao();


List<Product>listProduct;
public ListProductController() {}

@Override
public String execute() throws Exception {

setListProduct(pruductDao.listProduct());
return SUCCESS;

public List<Product> getListProduct() {


return listProduct;
}

public void setListProduct(List<Product> listProduct) {


this.listProduct = listProduct;
}

public ProductDao getPruductDao() {


return pruductDao;
}

public void setPruductDao(ProductDao pruductDao) {


this.pruductDao = pruductDao;
}

Page 1

You might also like