0
我無法在JavaScript中調用Java函數。我想,當我將像Var這樣的參數傳遞給字符串方法時,我做錯了。請給我你的建議。如何將字符串參數傳遞給JavaScript函數中的Java方法
function calculateTotalAmount()
{
var formFldAreaCode = eval("document.AccountsSummaryListing.<%=SWPAppConstants.AREA_CODE%>");
alert("area code "+formFldAreaCode.value);
var formFldExchange = eval("document.AccountsSummaryListing.<%=SWPAppConstants.EXCHANGE%>");
alert("formFldExchange "+formFldExchange.value);
var formFldConnector = eval("document.AccountsSummaryListing.<%=SWPAppConstants.CONNECTOR%>");
alert("formFldConnector code "+formFldConnector.value);
var formFldConnectorSuffix = eval("document.AccountsSummaryListing.<%=SWPAppConstants.CONNECTOR_SUFFIX%>");
alert("formFldConnectorSuffix code "+formFldConnectorSuffix.value);
//getting error here
var installmentAmount = '<%=smPage.getFreeDomTerminationFee(formFldAreaCode.value,formFldExchange.value,"'formFldConnector.value,formFldConnectorSuffix.value)%>';
alert("Alert "+installmentAmount);
}
Java方法() 公共字符串getFreeDomTerminationFee(字符串AREACODE,字符串交換,字符串連接,字符串後綴)拋出異常 {
System.out.println("Ramesh areaCode "+areaCode);
m_logMgr.logMessage(LogManager.LOG_EVENT,"AccountsSummaryListing "+areaCode+"exchange "+exchange+"connector "+connector+" suffix "+suffix, m_FTCuserContext.getCurrentUserId(), 10, 1);
/* Connection origConn = m_bussContext.getConnection();
Connection sosConn = getSOSConnection();
m_bussContext.setConnection(sosConn);*/
FreedomPlnManager frdmPlnMngr = new FreedomPlnManager(this.m_bussContext, this.m_FTCuserContext);
String installmentAmount = "0";
FreedomPlnDS freedomPlnDS = frdmPlnMngr.getFreedomPlanDetails(areaCode,exchange ,connector ,suffix);
//m_bussContext.setConnection(origConn);
if(freedomPlnDS!= null){
installmentAmount = freedomPlnDS.getInstallmentAmount();
}
m_logMgr.logMessage(LogManager.LOG_EVENT,"AccountsSummaryListing:etfValue = "+installmentAmount, m_FTCuserContext.getCurrentUserId(), 10, 1);
return installmentAmount;
}