Title: Name attribute, not working for me...

You’re never actually putting the list anywhere the displaytag library can find it.  All the pageScope and requestScope qualifiers won’t do you any good if you don’t actually put it in the page or request scope!  But you’re basically correct in your suspicion as to what you’re doing wrong.  So just change it up so that instead of putting it in the session, you’re putting it in the request:

<%
List theData = (...call to method that returns a List);
request.setAttribute(“theData”, theData);
%>

<body>
    <display:table name="theData" export="true" pagesize="10">
        <display:column property="col1" title="Column 1" sortable="true"/>
        <display:column property="col2" title="Column 2" sortable="true" />
    </display:table>
</body>

You’re also correct in your suspicion that you’re (sorta) misusing name to reference a local variable.  You can never reference a local variable, displaytag ALWAYS tries to get the list as an attribute from some scope using the specified value for the name attribute: pageContext.getAttribute(name), request.getAttribute(name), session.getAttribute(name), etc.  So in your example, the local variable could be named fred and as long as you store the object as an attribute with the name “theData” then <display:table name=”theData”> will find it.

 

Rick Herrick

[EMAIL PROTECTED]

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Burgess, Randy
Sent: Wednesday, August 02, 2006 5:15 AM
To: displaytag-user@lists.sourceforge.net
Subject: Re: [displaytag-user] Name attribute, not working for me...

 

How about name=”pageScope.theData”?

 

RB


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Keenan, Mark
Sent: Wednesday, August 02, 2006 8:00 AM
To: 'displaytag-user@lists.sourceforge.net'
Subject: [displaytag-user] Name attribute, not working for me...

 

Hi All,

Im using the latest version of the display tag on Tomcat5. The following code always results in no data being displayed by the tag:

<%
List theData = (...call to method that returns a List);
%>

<body>
    <display:table name="theData" export="true" pagesize="10">
        <display:column property="col1" title="Column 1" sortable="true"/>
        <display:column property="col2" title="Column 2" sortable="true" />
    </display:table>
</body>

I suspect that I am using the "name" incorrectly to reference the local JSP variable "theData". If I put the Map into session and then use "sessionScope.theData" for the name, everything displays as you would expect.

However, I don't want to have to put the List into session as I then have no way of cleaning it out after the page has been rendered!

Any help appreciated,
Thanks.
Mark

 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to