I'm curious - what are the common ways of doing HTML reporting against java
classes?

The type of data I want to display on my reports can change a lot so it
seems like creating a bunch of classes to hold all the data for a specific
report is not the way to go...but what is?

I'll use a very simple specific example to help clarify:
ie, I need to generate a payout report for an online store (we let people
set up online stores and they get commissions for the markup)...

I want the report to contain the following:
    line 1:    tshirts, quantity sold, commission
    line 2:    mugs,  quantity sold, commission
    line 3:    large mugs, quantity sold, commission
    line 4:    mouse pads, quantity sold, commission
    line 5:    total commission

So I can create a StoreReport class than contains ReportLine classes in a
vector so from my JSP I can call storeReport.getLine(Product.TSHIRT), which
returns a ReportLine object with getQuantity, getCommision methods.  The
StoreReport class would have a getTotalCommission method.  The StoreReport
class is filled out by calling a StoreReportManager class with the storeNo
to be reported on, it runs a query and fills out the storeReport object.

Then flesh out the report and make it look fancy in my JSP.  But this seems
inflexible...I'd like to hear some other approaches.

The above would look something like:

public class StoreReportManager {
  public static StoreReport getStoreReport(int storeNo){
     // run query
     // create StoreReport object, create the ReportLine objects from query
results
    return storeReport;
  }
}

public class StoreReport{
    reportLineVector(); // yeah. I know -  it could be an array
    public ReportLine getReportLine(int productType){
    // returns report line for a specific product type (Product.TSHIRT,
    // Product.MOUSEPAD, Product.LARGE_MUG, Product.MUG)

    public
alCommission(){
        iterates thru the rerport lines and returns total commission
    }

    public add
ReportLine(int productType, int qty, double commission){
        creates ReportLine and adds to vector;
    }
}

public class ReportLine{
    public void setProductType(int productType);
    public void setQuantity(in qty);
    public void setCommission(double commission);
    public int getProductType();
    public int getQuantity();
    public int getCommission();
}

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to