Problem with export in display tag

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with export in display tag

Raaja G
Hi,

When I am trying to export the contents from display table with decorator class. The fields in the export file is showing the returned value in the decorator class rather that displayed text in the table. What I have to change if I want the text displayed in the table should be exported.

My table declaration is:

<display:table id="data" name="logisticreport"
        requestURI="/GetLogisticReport.do" pagesize="10" export="true"
        decorator="com.scrabble.project.model.LogisticReportDecorator">
       
        <display:column property="hddBarcode" title="Barcode"
                sortable="true" style="text-align:center;" />
        <display:column property="clientname" title="Client"
                sortable="true" style="text-align:center;" />
        <display:column property="diskreturndate" title="HDD Return date"
                sortable="true" style="text-align:center;" />
        <display:column property="email" title="Email"/>
       
        <display:setProperty name="export.pdf" value="true" />
        <display:setProperty name="export.pdf.filename" value="LogisticReport.pdf" />
        <display:setProperty name="export.excel.filename" value="LogisticReport.xls" />
        <display:setProperty name="export.xml" value="false" />
        <display:setProperty name="export.csv" value="false" />
        <display:setProperty name="export.xls" value="false" />
</display:table>


My decorator class is:

public class LogisticReportDecorator extends TableDecorator {
        public String getEmail(){
       
                LogisticReportVO lrVo = (LogisticReportVO)getCurrentRowObject();
                Integer ldays = lrVo.getLapseddays();
                String email =  lrVo.getEmail();
                if(ldays>90){
                        return "<html:link href=\"../GetLogisticReport.do?email=" + email + "&amp;client="+lrVo.getClientname()+"&amp;ldays="+ldays+"&amp;projectid="+lrVo.getProjectid()+"&amp;drdate="+lrVo.getDiskreturndate()+"&amp;bcode="+lrVo.getHddBarcode()+"\">"+email+"</html:link>";
     }else{
         return email;
     }
}
}

Instead of html:link I used general anchor tag also but the result is same.

Result what I am getting is: (please see below if not the attachments also if needed)

LogisticReport.xls
LogisticReport.pdf

126   HyderabadClient  6/1/2011     a href="../GetLogisticReport.do?email=raaja.g@krishct.com&client=HyderabadClient&ldays=92&projectid=6&drdate=02/31/2011&bcode=126">raaja.g@krishct.com /a

I want only this in the exported file

126            HyderabadClient           6/1/2011                raaja.g@krishct.com      

Please help me in getting this.

Thanking you.

--raaja. g
Reply | Threaded
Open this post in threaded view
|

Re: Problem with export in display tag

naveen
for link use media=html like this
 
<display:column property="email" title="Email" media="html"/>
 
for generating to pdf use media=pdf
 
<display:column property="email" title="Email" media="pdf"/>
 
and according to your code you are using same field name for your decorator method and also your field in java bean,try changing your decorator methid to something else
 
for link use media=html like this
 
<display:column property="email1" title="Email" media="html"/>
 
for generating to pdf use media=pdf
 
<display:column property="email" title="Email" media="pdf"/>
 
so now u declare the method in decorator as getEmail1()
 
Thanks,
Naveen.
 
On Fri, Jun 3, 2011 at 2:34 AM, Raaja G <[hidden email]> wrote:

Hi,

When I am trying to export the contents from display table with decorator
class. The fields in the export file is showing the returned value in the
decorator class rather that displayed text in the table. What I have to
change if I want the text displayed in the table should be exported.

My table declaration is:

<display:table id="data" name="logisticreport"
       requestURI="/GetLogisticReport.do" pagesize="10" export="true"
       decorator="com.scrabble.project.model.LogisticReportDecorator">

       <display:column property="hddBarcode" title="Barcode"
               sortable="true" style="text-align:center;" />
       <display:column property="clientname" title="Client"
               sortable="true" style="text-align:center;" />
       <display:column property="diskreturndate" title="HDD Return date"
               sortable="true" style="text-align:center;" />
       <display:column property="email" title="Email"/>

       <display:setProperty name="export.pdf" value="true" />
       <display:setProperty name="export.pdf.filename" value="LogisticReport.pdf"
/>
       <display:setProperty name="export.excel.filename"
value="LogisticReport.xls" />
       <display:setProperty name="export.xml" value="false" />
       <display:setProperty name="export.csv" value="false" />
       <display:setProperty name="export.xls" value="false" />
</display:table>


My decorator class is:

public class LogisticReportDecorator extends TableDecorator {
       public String getEmail(){

               LogisticReportVO lrVo = (LogisticReportVO)getCurrentRowObject();
               Integer ldays = lrVo.getLapseddays();
               String email =  lrVo.getEmail();
               if(ldays>90){
                       return "<html:link href=\"../GetLogisticReport.do?email=" + email +
"&amp;client="+lrVo.getClientname()+"&amp;ldays="+ldays+"&amp;projectid="+lrVo.getProjectid()+"&amp;drdate="+lrVo.getDiskreturndate()+"&amp;bcode="+lrVo.getHddBarcode()+"\">"+email+"</html:link>";
    }else{
        return email;
    }
}
}

Instead of html:link I used general anchor tag also but the result is same.

Result what I am getting is: (please see below if not the attachments also
if needed)

http://old.nabble.com/file/p31763232/LogisticReport.xls LogisticReport.xls
http://old.nabble.com/file/p31763232/LogisticReport.pdf LogisticReport.pdf

126        HyderabadClient        6/1/2011              a
href="../GetLogisticReport.do?email=[hidden email]&amp;client=HyderabadClient&amp;ldays=92&amp;projectid=6&amp;drdate=02/31/2011&amp;bcode=126">[hidden email]
/a

I want only this in the exported file

126                 HyderabadClient                6/1/2011
[hidden email]

Please help me in getting this.

Thanking you.

--raaja. g
--
View this message in context: http://old.nabble.com/Problem-with-export-in-display-tag-tp31763232p31763232.html
Sent from the DisplayTag - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today.
http://p.sf.net/sfu/quest-dev2dev2
_______________________________________________
displaytag-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-user


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today.
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
displaytag-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-user
Reply | Threaded
Open this post in threaded view
|

Re: Problem with export in display tag

Raaja G
Hi Naveen,

Thanks for the reply. Its working good.

--raaja. g
Reply | Threaded
Open this post in threaded view
|

Re: Problem with export in display tag

                       
               
Raaja G
In reply to this post by naveen
Hi,

I followed the instructions and modified accordingly and got the display in the format I want for the first time. But it is giving problem when I send a mail on clicking the link. After wards even for export options the link is getting attached and whenever I click on PDF / Excel first it sending the mail and exporting. Where I am going wrong please tell me.

Below I am giving my modified display table and view source of the jsp before sending the mail and after sending the mail.




My table declaration is:

<display:table id="data" name="logisticreport"
        requestURI="/GetLogisticReport.do" pagesize="10" export="true"
        decorator="com.scrabble.project.model.LogisticReportDecorator"> 
       
        <display:column property="hddBarcode" title="Barcode"
                sortable="true" style="text-align:center;" /> 
        <display:column property="clientname" title="Client"
                sortable="true" style="text-align:center;" /> 
        <display:column property="diskreturndate" title="HDD Return date"
                sortable="true" style="text-align:center;" /> 
     
        <display:column property="cemail" title="Email" media="html"/>
        <display:column property="email" title="Email" media="pdf"/>
        <display:column property="email" title="Email" media="excel"/>

       
        <display:setProperty name="export.pdf" value="true" /> 
        <display:setProperty name="export.pdf.filename" value="LogisticReport.pdf" /> 
        <display:setProperty name="export.excel.filename" value="LogisticReport.xls" /> 
        <display:setProperty name="export.xml" value="false" /> 
        <display:setProperty name="export.csv" value="false" /> 
        <display:setProperty name="export.xls" value="false" /> 
</display:table> 


view source before sending mail:







BarcodeClientSubmission DateHDD Return dateLapsed DaysEmail
121HyderabadClient06/01/201105/31/20114raaja.g@krishct.com
122ChennaiClient06/01/201105/31/20114sureshreddy@krishct.com
123MumbaiClient06/01/201105/26/20119raaja.g@krishct.com
125MumbaiClient06/01/201105/31/20114raaja.g@krishct.com
126HyderabadClient06/01/201102/31/201193a href="../GetLogisticReport.do?email=raaja.g@krishct.com&client=HyderabadClient&ldays=93&projectid=6&drdate=02/31/2011&bcode=126">raaja.g@krishct.com /a
129ChennaiClient06/01/201105/24/201111sureshreddy@krishct.com
124ChennaiClient06/01/201105/31/20114sureshreddy@krishct.com
<div class="exportlinks">Export To:
a href="/scrabble/GetLogisticReport.do?6578706f7274=1&pname=6&projectid=6&projectid=&d-49216-e=2">Excel  /a |
a href="/scrabble/GetLogisticReport.do?6578706f7274=1&pname=6&projectid=6&projectid=&d-49216-e=5">PDF /a</div></div>
                                </center>
                               


view source after sending the mail:








Barcodea href="/scrabble/GetLogisticReport.do?d-49216-o=2&client=HyderabadClient&d-49216-s=1&email=raaja.g%40krishct.com&bcode=126&ldays=93&drdate=02%2F31%2F2011&projectid=6">Client /aSubmission DateHDD Return dateLapsed DaysEmail
121HyderabadClient06/01/201105/31/20114raaja.g@krishct.com
122ChennaiClient06/01/201105/31/20114sureshreddy@krishct.com
123MumbaiClient06/01/201105/26/20119raaja.g@krishct.com
125MumbaiClient06/01/201105/31/20114raaja.g@krishct.com
126HyderabadClient06/01/201102/31/201193a href="../GetLogisticReport.do?email=raaja.g@krishct.com&client=HyderabadClient&ldays=93&projectid=6&drdate=02/31/2011&bcode=126">raaja.g@krishct.com /a
129ChennaiClient06/01/201105/24/201111sureshreddy@krishct.com
124ChennaiClient06/01/201105/31/20114sureshreddy@krishct.com
<div class="exportlinks">Export To:
a href="/scrabble/GetLogisticReport.do?client=HyderabadClient&email=raaja.g%40krishct.com&6578706f7274=1&bcode=126&ldays=93&drdate=02%2F31%2F2011&projectid=6&d-49216-e=2">Excel /a|
a href="/scrabble/GetLogisticReport.do?client=HyderabadClient&email=raaja.g%40krishct.com&6578706f7274=1&bcode=126&ldays=93&drdate=02%2F31%2F2011&projectid=6&d-49216-e=5">PDF a</div></div>

                                </center>
                                                                       

The table export link is getting modified. I want whenever I click on export options only the data should get export not to send the mail.

Please help me in solving this.

--raaja.g