0

目前正在使用 Struts 1.2.9。在我的 actionForm 页面中,我有一些 switch 语句。结束此 switch 语句后,我如何从 ActionForm 页面调用 servlet。我的代码是,

public void populateExcelReportValues(HttpServletRequest request) throws Exception
{
    String METHOD_NAME = "populateExcelReportValues";
    log.entering(CLASS_NAME, METHOD_NAME);
    //Rating Element Id 
    String ratingElementIdForExcel = request.getParameter("ratingElementIdFromJSP");
    //Instance Type Name
    String instanceTypeForExcel = request.getParameter("instanceTypeFromJSP");

    int ratingElementIdForExcelInt = 0;

    String instanceTypeValueForExcel = "";
    if(ratingElementIdForExcel != null && ratingElementIdForExcel.trim().length()>0)
    {
        ratingElementIdForExcelInt = Integer.parseInt(ratingElementIdForExcel);
    }
    if(instanceTypeForExcel != null && instanceTypeForExcel.trim().length()>0)
    {
        instanceTypeValueForExcel = instanceTypeForExcel.trim();
    }
    switch (ratingElementIdForExcelInt) 
    {
        case 1: //ASN Accuracy - Rating Element ID - 1 
                weeklyDeliveryInstancesRatingElementQO = getASNAccuracyRatingElement(instanceTypeValueForExcel);
                //return weeklyDeliveryInstancesRatingElementQO;
                break;
        case 2: //Manual ASN - Rating Element ID - 2
                weeklyDeliveryInstancesRatingElementQO = getManualASNRatingElement(instanceTypeValueForExcel);
                break;
        case 3: //Packaging - Rating Element ID - 3 
                weeklyDeliveryInstancesRatingElementQO = getPackagingRatingElement(instanceTypeValueForExcel);
                break;
        case 4: //Behind Schedule - Rating Element ID - 4
                weeklyDeliveryInstancesRatingElementQO = getBehindScheduleRatingElement(instanceTypeValueForExcel);
                //return weeklyDeliveryInstancesRatingElementQO;
                break;
        case 5: //Cum Imbalance - Rating Element ID - 5
                weeklyDeliveryInstancesRatingElementQO = getCumImbalanceRatingElement(instanceTypeValueForExcel);
                break;
        case 6: //OverShipment - Rating Element ID - 6
                weeklyDeliveryInstancesRatingElementQO = getOverShipmentRatingElement(instanceTypeValueForExcel);
                break;
        case 7: //ASNTimeliness - Rating Element ID - 7
                weeklyDeliveryInstancesRatingElementQO = getASNTimelinessRatingElement(instanceTypeValueForExcel);
                //return weeklyDeliveryInstancesRatingElementQO;
                break;
        case 8: //UnAnsweredDDL Shortages - Rating Element ID -  8
                weeklyDeliveryInstancesRatingElementQO = getUnAnsweredDDLShortagesRatingElement(instanceTypeValueForExcel);
                break;
        case 9: //Supplier Delivery Contact Updates - Rating Element ID - 9
                weeklyDeliveryInstancesRatingElementQO = getSupplierDeliveryContactUpdatesRatingElement(instanceTypeValueForExcel);
                break;
        case 10: //Shipping Discrepancies - Rating Element ID - 10
                weeklyDeliveryInstancesRatingElementQO = getShippingDiscrepanciesRatingElement(instanceTypeValueForExcel);
                //return weeklyDeliveryInstancesRatingElementQO;
                break;
        case 13: //SDS Promise Accuracy - Rating Element ID - 13
                weeklyDeliveryInstancesRatingElementQO = getSDSPromiseAccuracyRatingElement(instanceTypeValueForExcel);
                break;
        case 15: //Behind Schedule Emergency Orders - Rating Element ID - 15
                weeklyDeliveryInstancesRatingElementQO = getBehindScheduleEmergencyOrdersRatingElement(instanceTypeValueForExcel);
                break;
        default:
                weeklyDeliveryInstancesRatingElementQO = new ArrayList<WeeklyDeliveryInstancesRatingElementQO>();
                break;
    }

    log.exiting(CLASS_NAME, METHOD_NAME);

    (Link)/MultiTableExportServlet?multitablesId=WeeklyDeliveryInstances-Count&amp;name=WeeklyDeliveryInstances-Count&amp;type=excel   

}

在我的 switch 语句执行后,我突出显示了我想要调用的代码。

4

1 回答 1

1
request.getRequestDispatcher("other servlet").forward(request, response);
于 2012-10-18T08:38:59.083 回答