【发布时间】:2016-07-30 05:52:31
【问题描述】:
我正在使用参数从 jQuery 调用 struts2 动作,但未调用动作方法。
但是如果我在没有参数的情况下调用该动作,那么它可以完美地工作。
调用动作:
$('#redemptionForm').attr('action','sendRedempOTP?pbCardNo='+cardNo+'&mobile='+mobileNumber+'&isSearchByMobileNoFlag='+searchByMobileNoFlag);
Struts2 动作细节:
<action name="sendRedempOTP" class="com.ndil.web.redemption.ViewGiftItemSlabsAction"
method="sendOTP">
<interceptor-ref name="basicStack" />
<result name="error">/jsp/balanceinquirymain2.jsp</result>
<result>/jsp/balanceinquirymain2.jsp</result>
</action>
动作类方法:
public String sendOTP() {
LOGGER.info("Send OTP called");
String cardNumber = request.getParameter("pbCardNo");
String mobile = request.getParameter("mobile");
String isSearchByMobileNoFlag = request.getParameter("isSearchByMobileNoFlag");
}
当我调用此操作时,它不起作用。 我遇到了异常:
No configuration found for the specified action: 'login' in namespace:
这段代码有什么问题?
我的 JSP 页面:
<s:form action="#" validate="true" method="post" id="redemptionForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="1" style="background-color: #999">
<tr>
<td style="background-color: #f1f1f1">
<table width="950" border="0" cellpadding="2" cellspacing="0" align="center">
<tr align="center">
<td class="fieldtxt" width="50%" align="right"><s:text name="redeem.cardNo" /></td>
<td width="50%" align="left"><s:property value="giftRedemptionVO.pbCardNo" /></td>
</tr>
<tr align="center">
<td class="fieldtxt" width="50%" align="right"><s:text name="redeem.mobileNo" /></td>
<td width="50%" align="left"><s:property value="giftRedemptionVO.mobileNo" /></td>
</tr>
<tr id="custNameRow" align="center">
<td class="fieldtxt" width="50%" align="right"><s:text name="redeem.total.available.shopping.value" /></td>
<td width="50%" align="left"><s:property value="giftRedemptionVO.totalAvailableAmount" /></td>
</tr>
</td>
</tr>
</table>
<td><s:submit value="Redeem(SendOTP)" cssClass="crt_btn" id="sendOtpButton" theme="simple"
</td>
</tr>
</table>
</s:form>
【问题讨论】:
-
请发布您的jsp代码。
-
我看不到你的 Jquery 代码。
-
我已经在上面提到了我是如何从 JSP 页面调用我的操作的。
-
使用 $('#redemptionForm').attr('action','sendRedempOTP?pbCardNo='+cardNo.value()+'&mobile='+mobileNumber.value()+'&isSearchByMobileNoFlag= '+searchByMobileNoFlag.value());
-
为什么
login操作的配置会被记录?
标签: java jquery jsp http struts2