ashwinsakthi
ashwinsakthi

Reputation: 1956

Error while navigating between pages using struts display tag

I am getting the following error when moving between pages of the display tag:

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

However when I click the search button twice it is moving to the next page.

I'm struggling on this issue for the past couple of days. Any help would be appreciated.

Here is some of my code:

<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>

struts-config:

<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>

tiles-def:

<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();
     }   
}
}

Below is the display tag used.

<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>

Upvotes: 1

Views: 2479

Answers (2)

ashwinsakthi
ashwinsakthi

Reputation: 1956

thanks for the reply.. i guess my issue got resolved...the problem was a lot of data passed in the the query string coming from the request page...as the query string exceeded the permitted length for a get request, the method='showSeatRprt' was appending later in the query string the paging wasn't able to find the parameter method and since the query string was truncated.

Hence it was displaying the corresponding message...Now its working fine...

Upvotes: 0

Bogdan
Bogdan

Reputation: 24590

The error message you are receiving is self explanatory: you are missing the method parameter.

From your code it seems you are using a DispatchAction. This type of Struts Action contains a bunch of "personalized execute methods" and uses a request parameter to determine which one to call. The request parameter is called method in your case:

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

This must be present on all requests to your action or Struts won't know what method to call.

I see you already have two methods called loadPage and showSeatRprt. Do you have others? Do you have one that receives the paging requests?

When you navigate between the pages, the display tag creates the proper request URL starting from its requestURI parameter, in your case requestURI="/seatreportsubmit.do". I think this is where you are missing the method parameter.

Try adding a handlePaging method in your Action class then change the display tag's requestURI to something like this: requestURI="/seatreportsubmit.do?method=handlePaging" and see if it gets control when you navigate through the pages.

Upvotes: 3

Related Questions