Following is my code to display rows using display-tag
in struts 1.3
but it always shows: Nothing found to display
. I have checked ResultSet
and ArrayList
object, they all contain data.
<display:table export="true" id="data"
name="sessionScope.MultipleStudentsDAO.studentList"
requestURI="/mssrv.do" pagesize="5">
<display:column property="rollNo" title="ROLL NO" sortable="true" />
<display:column property="name" title="NAME" sortable="true" />
<display:column property="branch" title="BRANCH" sortable="false" />
</display:table>
Using sessionScope.MultipleStudentsDAO.studentList
in the name
attribute, display:table
will be looking in the session
for an object called MultipleStudentsDAO
and then calling its studentList
property. For this to work you should be doing something like this in your Java code:
MultipleStudentsDAO yourVariableOfTypeMultipleStudentsDAO = ...
session.setAttribute("MultipleStudentsDAO", yourVariableOfTypeMultipleStudentsDAO);
Note that MultipleStudentsDAO
is the name I have given the session
attribute and not necessarily the name of the class (although they happen to be the same in this case to make your JSP code work).
As an aside, I would advise against storing an attribute in the session
unless there is a particular reason why you need to - put it in the request instead, for example:
MultipleStudentsDAO multipleStudentDAO = ...
request.setAttribute("studentDAO", multipleStudentDAO);
You then don't need to specify the scope in the tag and can just do this:
<display:table export="true" id="data"
name="studentDAO.studentList"
requestURI="/mssrv.do" pagesize="5">