2012-10-18 21 views
0

目前我正在使用Struts 1.2.9。在我的actionForm頁面中,我有一些switch語句。結束這個switch語句之後,我該如何從ActionForm頁面調用一個servlet。 我的代碼,如何在ActionForm(struts1.2.9)中完成我的邏輯後調用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語句執行後的代碼。

回答

1
request.getRequestDispatcher("other servlet").forward(request, response); 
+1

我試着讓你知道...謝謝你的回答.. –

+0

它拋出錯誤outputstream已經獲得 –

相關問題