Jsp Struts和传递带有follow标记的params,它是如何工作的?
我有一个jsp页面,其代码如下:Jsp Struts和传递带有follow标记的params,它是如何工作的?,jsp,struts,Jsp,Struts,我有一个jsp页面,其代码如下: <script language="JavaScript"> function doOK() { var form = getForm(); if(form.varianceIsZeroOrReroute.value == '<%=ReIMConstants.NO%>') { if(!confirm("<bean:message key="alert.confirm
<script language="JavaScript">
function doOK()
{
var form = getForm();
if(form.varianceIsZeroOrReroute.value == '<%=ReIMConstants.NO%>')
{
if(!confirm("<bean:message key="alert.confirm_resolution_variance_not_zero"/>"))
{
return;
}
}
form.saveAction.value = '<%=PriceReviewListForm.SAVE_ACTION_OK%>';
form.action = "priceReviewVarianceResolutionSave.do";
form.submit();
return true;
}
<action path="/priceReviewVarianceResolutionSave"
type="org.springframework.web.struts.DelegatingActionProxy"
name="PriceReviewListForm" scope="session">
<forward name="failureInvoice"
path="/price_review_variance_resolution.jsp" />
<forward name="failureDocument"
path="/price_review_variance_resolution_dispute.jsp" />
<forward name="successFull" path="/price_review_list.jsp" />
<forward name="successMore"
path="/priceReviewDetailLoad.do" />
<forward name="successDone" path="/home.do?targetTab=t4" />
<forward name="successApplyAll"
path="/priceReviewListLoad.do" />
<forward name="detailMatch" path="/detailMatchBegin.do" />
<forward name="unauthorized_access"
path="/home.do?targetTab=t4" />
</action>
函数doOK()
{
var form=getForm();
if(form.varianceiszeroorroute.value=='')
{
如果(!确认(“”)
{
返回;
}
}
form.saveAction.value='';
form.action=“PriceReviewVarianceSolutionSave.do”;
表单提交();
返回true;
}
然后像这样
<tr class="gButtonRow">
<td colspan="4" align="center" class="gContentSection">
<html:button property="Back" styleClass="gButton" onclick="back();"><bean:message key="button.back"/></html:button>
<html:button property="OK" styleClass="gButton" onclick="doOK()"> <bean:message key="button.ok"/> </html:button>
<html:button property="Delete" styleClass="gButton" onclick="deleteRecords();"><bean:message key="button.delete"/></html:button>
<html:button property="ApplyAll" styleClass="gButton" onclick="doApplyAll();"><bean:message key="button.apply_all"/></html:button>
<html:button property="Cancel" styleClass="gButton" onclick="doCancel();"><bean:message key="button.cancel"/></html:button>
</td>
</tr>
</table>
因此,正如您在doOK中看到的,有对PriceReviewVarianceSolutionsSave路径的引用。在struts-config.xml中,路径描述如下:
<script language="JavaScript">
function doOK()
{
var form = getForm();
if(form.varianceIsZeroOrReroute.value == '<%=ReIMConstants.NO%>')
{
if(!confirm("<bean:message key="alert.confirm_resolution_variance_not_zero"/>"))
{
return;
}
}
form.saveAction.value = '<%=PriceReviewListForm.SAVE_ACTION_OK%>';
form.action = "priceReviewVarianceResolutionSave.do";
form.submit();
return true;
}
<action path="/priceReviewVarianceResolutionSave"
type="org.springframework.web.struts.DelegatingActionProxy"
name="PriceReviewListForm" scope="session">
<forward name="failureInvoice"
path="/price_review_variance_resolution.jsp" />
<forward name="failureDocument"
path="/price_review_variance_resolution_dispute.jsp" />
<forward name="successFull" path="/price_review_list.jsp" />
<forward name="successMore"
path="/priceReviewDetailLoad.do" />
<forward name="successDone" path="/home.do?targetTab=t4" />
<forward name="successApplyAll"
path="/priceReviewListLoad.do" />
<forward name="detailMatch" path="/detailMatchBegin.do" />
<forward name="unauthorized_access"
path="/home.do?targetTab=t4" />
</action>
据我所知,它从表单中读取某种输入,并根据它转到特定页面。例如,如果值为“successApplyAll”,则它将转到“/priceReviewListLoad.do”。但问题是,我看不到jsp代码中提到“successApplyAll”。因此,我不知道在哪里可以找到将“successApplyAll”传递到“PriceReviewVarianceSolutionSave”部分的代码。当然,我遗漏了一些部分或是弄错了。你能帮我解释一下在哪里可以找到这部分代码吗?谢谢 转发名称在操作中用于确定下一步操作
甚至
grep
都可以帮助您找到代码中使用该字符串的位置,即使假设您完全不了解Struts。也就是说:如果您正在使用Struts代码库,那么退一步,至少学习一些基础知识可能是有意义的。谢谢,您的答案很有帮助!是的,学习基本知识是有帮助的,但问题是客户没有为此花费时间,而是要求快速发现您不知道的任务中的错误,而其他人在之前领导了该任务。)@kindproc理解,但在我看来,即使花一个小时回顾S1的工作原理也值得您花时间。