Javaメソッドでhrefリンクを呼び出す必要があります。私のサンプルコードは以下のように定義されています。ロジックを終了した後、URLを呼び出す必要があります。このURLは、Excelブックを開き、そこにBean値をインポートするために使用されます。
public void populateExcelReportValues(HttpServletRequest request, HttpServletResponse response) 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);
System.out.println("ratingElementIdForExcelInt: "+ratingElementIdForExcelInt);
}
if(instanceTypeForExcel != null && instanceTypeForExcel.trim().length()>0)
{
instanceTypeValueForExcel = instanceTypeForExcel.trim();
System.out.println("instanceTypeValueForExcel: "+instanceTypeValueForExcel);
}
switch (ratingElementIdForExcelInt)
{
case 1: //ASN Accuracy - Rating Element ID - 1
weeklyDeliveryInstancesRatingElementQO = getASNAccuracyRatingElement(instanceTypeValueForExcel);
//return weeklyDeliveryInstancesRatingElementQO;
break;
default:
weeklyDeliveryInstancesRatingElementQO = new ArrayList<WeeklyDeliveryInstancesRatingElementQO>();
break;
}
//How to invoke this url to here
**(MultiTableExportServlet?multitablesId=WeeklyDeliveryInstances-Count&name=WeeklyDeliveryInstances-Count&type=excel)**
log.exiting(CLASS_NAME, METHOD_NAME);
}
上記の私のコードでは、あなたの識別のために太字で示しました。
Jspページ:
<display:table name="${weeklyDlvyInstancesDashboardReportForm.asnAccuracyListQO}" uid="asnAccuracyListUID" sort="list" defaultsort="1"
requestURI="/weeklyDlvyInstancesDashboardReportPre.do?method=httpGet" excludedParams="method"
decorator="com.ford.mpl.superg.decorator.WeeklyDeliveryInstancesTypeTableDecorator" keepStatus="true">
<%@include file="/jsp/include/displaytag.jsp"%>
<c:set value="${asnAccuracyListUID.firstWeekOfCountLabel}" var="asnAccuracyFirstWeekOfCount"/>
<c:set value="${asnAccuracyListUID.secondWeekOfCountLabel}" var="asnAccuracySecondWeekOfCount"/>
<c:set value="${asnAccuracyListUID.thirdWeekOfCountLabel}" var="asnAccuracyThirdWeekOfCount"/>
<c:set value="${asnAccuracyListUID.fourthWeekOfCountLabel}" var="asnAccuracyFourthWeekOfCount"/>
<c:set value="${asnAccuracyListUID.fifthWeekOfCountLabel}" var="asnAccuracyFifthWeekOfCount"/>
<c:set value="${asnAccuracyListUID.sixthWeekOfCountLabel}" var="asnAccuracySixthWeekOfCount"/>
<c:choose>
<c:when test="${asnAccuracyListUID.instanceTypeDescription != null && asnAccuracyListUID.instanceTypeDescription != 'Sum'}">
<display:column property="instanceTypeDescription" title="Instance Type" sortable="false"/>
</c:when>
<c:otherwise>
<display:column property="instanceTypeDescription" title="Instance Type" sortable="false" style="font-weight:bold;text-align:center"/>
</c:otherwise>
</c:choose>
<display:column property="firstWeekOfCount" title="${asnAccuracyFirstWeekOfCount}" sortable="false"/>
<display:column property="secondWeekOfCount" title="${asnAccuracySecondWeekOfCount}" sortable="false" />
<display:column property="thirdWeekOfCount" title="${asnAccuracyThirdWeekOfCount}" sortable="false" />
<display:column property="fourthWeekOfCount" title="${asnAccuracyFourthWeekOfCount}" sortable="false" />
<display:column property="fifthWeekOfCount" title="${asnAccuracyFifthWeekOfCount}" sortable="false" />
<display:column property="sixthWeekOfCount" title="${asnAccuracySixthWeekOfCount}" sortable="false"/>
</display:table>
</fieldset>
<export:multitables id="WeeklyDeliveryInstances-Count">
<export:table title="tablename" source="${weeklyDlvyInstancesDashboardReportForm.weeklyDeliveryInstancesRatingElementQO}">
<export:column property="shipCode" title="Ship Code" />
<export:column property="plantOrRecLoc" title="Plant/Rec Loc" />
<export:column property="instanceType" title="Instance Type" />
<export:column property="fordOrg" title="Ford Org" />
<export:column property="OrgType" title="Org Type" />
<export:column property="region" title="Region" />
<export:column property="shipDate" title="Ship Date" />
<export:column property="errorTransmitted" title="Error Transmitted" />
<export:column property="externalAlertNo" title="External Alert Number" />
<export:column property="asnNumber" title="ASN Number"/>
<export:column property="packingSlipNumber" title="Packing Slip Number"/>
</export:table>
</export:multitables>