0

I am trying to populate the list "li" from the LoginAction on to the jsp page using display-table.And that list should be selectable.But when i run my jsp it says "nothing found to display".What might be the problem.And is display-table a better approach to use to make the list selectable and editable? or is there any other turn around?Thanks

LoginAction.java

public class LoginAction extends Action {   
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                HttpServletResponse response) throws Exception
        {

            ActionForward nextPage = mapping.findForward("success");
                    LoginForm in  = (LoginForm) form;

                    CaseHistoryData cd =new CaseHistoryData();

                    List<CaseHistoryData> li = new ArrayList <CaseHistoryData>();
                    cd.setNo(1);
                    cd.setShortdesciption("NOA Data verified");
                    li.add(cd);
                    CaseHistoryData cd2 =new CaseHistoryData();
                    cd2.setNo(2);
                    cd2.setShortdesciption("Count Allowance");
                    li.add(cd2);
    }

CaseHistoryData.java

 public class CaseHistoryData extends ActionForm {
        private int no;
        private String shortdesciption;
    setter and getters}

AdvancedCorrection.jsp

<html:form action="/OnClick" method="post">
    <display:table export="true"  id="data"
                        name="sessionScope.LoginAction.li"
                        requestURI="/OnClick" pagesize="10" >
                <display:column property="no" title="No" sortable="true"   />

            </display:table>

Struts-config.xml

    <form-bean name="AdvancedCorrectionBean" type="us.gov.doc.uspto.patent.palm.advancedcorrection.web.domain.CaseHistoryData">
            </form-bean>

    <action path="/OnClick" type="us.gov.doc.uspto.patent.palm.advancedcorrection.web.action.LoginAction" name="AdvancedCorrectionBean" scope="session" 
            input="/AdvancedCorrectio

n.jsp" validate="true" >
         <forward name="success" path="/jsp/AdvancedCorrection.jsp" />

        </action>
Anupam
  • 7,966
  • 3
  • 41
  • 63
user1046671
  • 201
  • 3
  • 13
  • I suggest you to give [dataTables](http://datatables.net/) a try. It has endless features and doesnt requires the crappy format of display tag. – Anupam Jun 25 '12 at 15:33

1 Answers1

0

Your display:table looks for the list in sessionScope.LoginAction.li. But the LoginAction is not in session scope (it's not in any scope), and there is no getLi() method anyway in LoginAction that would return the list, and even if there was such a method, the list is just a local variable of the execute() method.

You need to store the list in a request attribute in your execute() method:

request.setAttribute("caseHistoryDataList", li);

and in the JSP, you need to use this request attribute:

<display:table name="caseHistoryDataList" ...
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255