gpt4 book ai didi

java - 使用 struts 显示标签在页面之间导航时出错

转载 作者:行者123 更新时间:2023-11-29 05:50:43 25 4
gpt4 key购买 nike

在显示标签的页面之间移动时出现以下错误:

Request [/seatreportsubmit] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text.

但是,当我点击搜索按钮两次时,它会移动到下一页。

过去几天我一直在为这个问题苦苦挣扎。任何帮助将不胜感激。

这是我的一些代码:

<table width="100%" align="center">
<tr>
<td align="Center">
<input type="button" class="buttonstyle" value="<bean:message key="button.search" />" onclick="searchsubmit();" styleClass="buttonstylebig">&nbsp;
<input type="button" class="buttonstyle" value="<bean:message key="button.reset" />" onclick="clearValues();">
</td>
</tr>
</table>

结构配置:

<action path="/seatreportsubmit"
type="com.ford.ape.seatreport.actionobject.SeatRprtAction"
name="SeatReportForm" scope="request" input="seatreport.details"
validate="true" parameter="method">
<forward name="openSeatDetails" path="seatreport.details" />
<forward name="showSeatDetails" path="seatreport.detailsreport" />
</action>

瓷砖定义:

<definition name="seatreport.details" extends="base.definition">
<put name="body" value="/jsp/SeatReport/SeatVacReport.jsp" />
</definition>
<definition name="seatreport.detailsreport" extends="base.definition">
<put name="body" value="/jsp/SeatReport/SeatVacReportDetailed.jsp" />
</definition>

js:

function searchsubmit()
{
if(search()==true)
{
if(document.forms[0].seatReportType.value=='Summary Report')
{
document.forms[0].seatLocation.value='';
document.forms[0].seatBuilding.value='';
document.forms[0].seatFloor.value='';
document.forms[0].seatType.value='';
document.forms[0].seatStatus.value='';
document.forms[0].seatCompany.value='';
document.forms[0].seatDepartment.value='';
document.forms[0].seatSubDepartment.value='';
document.forms[0].seatLL5.value='';
document.forms[0].seatLL6.value='';

document.forms[0].method.value="loadPage";
document.forms[0].submit();
}

else if(document.forms[0].seatReportType.value=='Detailed Report')
{
document.forms[0].method.value="showSeatRprt";
document.forms[0].submit();
}
}
}

下面是使用的显示标签。

<display:table name="requestScope.SeatReportForm.rprtData" id="table" export="true" sort="list" requestURI="/seatreportsubmit.do"   pagesize="20" align="center"  class="table_main" width="100%">

<display:column width="5%" align="center" class="hidden" media="Excel" title="Request No" headerClass="table_header" >
<%=((SeatRprtVO)table).getSeatNo()%>
</display:column>
<display:column class="label_text" property="seatLocation" title="Location" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="seatBuilding" title="Building" headerClass="table_header" width="3%" align="center"/>
<display:column class="label_text" property="seatFloor" title="Floor" headerClass="table_header" width="4%" align="center"/>
<display:column class="label_text" property="seatNo" title="Seat No" headerClass="table_header" width="4%" align="center"/>
<display:column class="label_text" property="seatType" title="Seat Type" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="seatStatus" title="Seat Status" headerClass="table_header" width="7%" align="center"/>

<%-- <display:column class="label_text" property="seatCategory" title="Seat Category"
headerClass="table_header" width="7%" align="center"/> --%>

<display:column class="label_text" property="cdsID" title="CDSID" headerClass="table_header" width="4%" align="center"/>
<display:column class="label_text" property="firstName" title="First Name" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="lastName" title="Last Name" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="ll6CdsId" title="LL6 CDSID" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="ll5CdsId" title="LL5 CDSID" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="ll4CdsId" title="LL4 CDSID" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="employeeType" title="Employee Type" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="company" title="Company" headerClass="table_header" width="7%" align="center"/>

<display:column class="label_text" property="department" title="Department" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="subDepartment" title="Sub-Department" headerClass="table_header" width="7%" align="center"/>
<display:column class="label_text" property="region" title="Region" headerClass="table_header" width="7%" align="center"/>


<display:setProperty name="export.xls.filename" value="rprtData.xls"/>
<display:setProperty name="css.tr.even" value="row1" />
<display:setProperty name="css.tr.odd" value="row2" />
<display:setProperty name="paging.banner.placement" value="bottom" />
<display:setProperty name="basic.msg.empty_list" value="No Records Found" />

</display:table>

最佳答案

您收到的错误消息不言自明:您缺少 method 参数。

从您的代码看来您正在使用 DispatchAction .这种类型的 Struts Action 包含一堆“个性化的 execute 方法”,并使用请求参数来确定调用哪一个。在您的情况下,请求参数称为 method:

<action path="/seatreportsubmit" .... parameter="method">

这必须出现在对您的操作的所有请求中,否则 Struts 将不知道调用什么方法。

我看到您已经有两个方法,分别是 loadPageshowSeatRprt。你还有其他人吗?你有接收寻呼请求的吗?

当您在页面之间导航时,显示标记从其 requestURI 参数开始创建正确的请求 URL,在您的例子中为 requestURI="/seatreportsubmit.do"。我认为这是您缺少 method 参数的地方。

尝试在您的 Action 类中添加一个 handlePaging 方法,然后将显示标签的 requestURI 更改为如下所示:requestURI="/seatreportsubmit.do?method=handlePaging" 和当您浏览页面时,看看它是否获得控制权。

关于java - 使用 struts 显示标签在页面之间导航时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13987486/

25 4 0