Click
Click Examples

Source Viewer : WEB-INF/classes/org/apache/click/examples/page/jsp/CustomerTable.java

package org.apache.click.examples.page.jsp;

import java.util.List;

import javax.annotation.Resource;

import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
import org.apache.click.examples.service.CustomerService;
import org.springframework.stereotype.Component;

/**
 * Provides JSP Page example where a JSP page and JSP border template is used to
 * render a table.
 */
@Component
public class CustomerTable extends BorderPage {

    private static final long serialVersionUID = 1L;

    @Resource(name="customerService")
    private CustomerService customerService;

    // Event Handlers ---------------------------------------------------------

    /**
     * @see org.apache.click.Page#onRender()
     */
    @Override
    public void onRender() {
        List<Customer> customers = customerService.getCustomersSortedByName(10);
        addModel("customers", customers);
    }

    // Public Methods ---------------------------------------------------------

    /**
     * Returns the name of the border template: &nbsp; <tt>"/border-template.jsp"</tt>
     *
     * @see org.apache.click.Page#getTemplate()
     */
    @Override
    public String getTemplate() {
        return "/border-template.jsp";
    }
}