Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Export to Excel with Indexing feature with Icefaces 1.8.2  RSS feed

 
Srikanth Neelakantachar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

As of now am using icefaces 1.8.2 provided tags for downloading data into excel sheet where i can download all the data from a data table.
But now the requirement is like need to download the data into excel sheet based on values passed from UI as parameters to the action class method.
Attaching the code snippet along with this post.


CustomerList.xhtml :-

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>

<td>
<ice:outputLabel value="Export:" />
</td>

<td width="100%" style="text-align:left;">
<ice:dataExporter for="CustomerListExporter"
type="excel"
rendered="#{customerHome.GetCustomerList().size() > 0}"
label="Export to Excel"
image="/img/excel.gif"
style="font-weight: bold;"
ignorePagination="true"
>
</ice:dataExporter>
</td>

</tr>
</table>

<ice:dataTable id="CustomerListExporter"
var="customer"
value="#{customerHome.GetCustomerList()}"
resizable="true"
columnClasses="allCols"
rendered="false">



<ice:column id="listcustomerIdId">
<f:facet name="header">
<ice:outputText value="Store Id" />
</f:facet>

<ice:outputText value="#{customer.customerNumber}" ></ice:outputText>
</ice:column>

<ice:column id="listcustomerIdId">
<f:facet name="header">
<ice:outputText value="Operation Type" />
</f:facet>

</ice:column>

<ice:column id="listcustomerNameId">
<f:facet name="header">
<ice:outputText value="Store Name" />
</f:facet>
<ice:outputText value="#{customer.customerName}" />
</ice:column>

<ice:column id="listaddressId">
<f:facet name="header">
<ice:outputText value="Address1" />
</f:facet>
<ice:outputText value="#{customer.address}" />
</ice:column>

<ice:column id="listaddressId">
<f:facet name="header">
<ice:outputText value="Address2" />
</f:facet>
<ice:outputText value="#{customer.address2}" />
</ice:column>

<ice:column id="listaddressId">
<f:facet name="header">
<ice:outputText value="Address3" />
</f:facet>
<ice:outputText value="#{customer.addressLine3}" />
</ice:column>

<ice:column id="listtownId">
<f:facet name="header">
<ice:outputText value="City" />
</f:facet>
<ice:outputText value="#{customer.town}" />
</ice:column>

<ice:column id="listtownId">
<f:facet name="header">
<ice:outputText value="State" />
</f:facet>
<ice:outputText value="#{customerHome.GetState(customer.customerId)}" />
</ice:column>

<ice:column id="listpostCodeId">
<f:facet name="header">
<ice:outputText value="Pincode" />
</f:facet>
<ice:outputText value="#{customerHome.GetCustPostcode(customer.customerId)}" />
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="CS Phone"/>
</f:facet>
<!--<ice:outputText value="#{customer.CSPhone}"></ice:outputText>-->
<ice:outputText value="#{customer.telephone}"></ice:outputText>
</ice:column>

<ice:column id="listmobileId">
<f:facet name="header">
<ice:outputText value="Comments" />
</f:facet>
<ice:outputText value="#{customer.notes}" />
</ice:column>

<ice:column id="listemailId">
<f:facet name="header">
<ice:outputText value="CS Email" />
</f:facet>
<ice:outputText value="#{customer.CSEmail}" />
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Alternate Phone"/>
</f:facet>
<ice:outputText value="#{customer.altPhone}"></ice:outputText>
</ice:column>

<ice:column id="listemailId">
<f:facet name="header">
<ice:outputText value="Alt Email" />
</f:facet>
<ice:outputText value="#{customer.altEmail}"/>
</ice:column>

<ice:column id="listmobileId">
<f:facet name="header">
<ice:outputText value="Non-Working Day" />
</f:facet>
<ice:outputText value="#{customer.non_working_day7}" />,<ice:outputText value="#{customer.non_working_day1}" />,<ice:outputText value="#{customer.non_working_day2}" />,<ice:outputText value="#{customer.non_working_day3}"/>,<ice:outputText value="#{customer.non_working_day4}" />,<ice:outputText value="#{customer.non_working_day5}" />,<ice:outputText value="#{customer.non_working_day6}" />
</ice:column>

<ice:column id="listmobileId">
<f:facet name="header">
<ice:outputText value="Non-Working Day(Alt)" />
</f:facet>
<ice:outputText value="#{customer.nonWorkingDayAlt}" />
</ice:column>

<ice:column id="listmobileId">
<f:facet name="header">
<ice:outputText value="Store Open Time" />
</f:facet>
<ice:outputText value="#{customer.storeOpenTime}" />
</ice:column>

<ice:column id="listmobileId">
<f:facet name="header">
<ice:outputText value="Store Close Time" />
</f:facet>
<ice:outputText value="#{customer.storeCloseTime}" />
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Near LandMark"/>
</f:facet>
<ice:outputText value="#{customer.nearLandmark}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Locality"/>
</f:facet>
<ice:outputText value="#{customer.locality}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Store Description"/>
</f:facet>
<ice:outputText value="#{customer.storeDescription}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Return Policy"/>
</f:facet>
<ice:outputText value="#{customer.returnPolicy}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Website URL"/>
</f:facet>
<ice:outputText value="#{customer.url}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Located In"/>
</f:facet>
<ice:outputText value="#{customer.locatedIn}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Target Age"/>
</f:facet>
<ice:outputText value="#{customer.targetAge}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Target Gender"/>
</f:facet>
<ice:outputText value="#{customer.targetGender}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Air Conditioned"/>
</f:facet>

<ice:outputText value="#{customer.airConditioned}" ></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Free Parking"/>
</f:facet>

<ice:outputText value="#{customer.freeParking}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Paid Parking"/>
</f:facet>

<ice:outputText value="#{customer.paidParking}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Home Delivery"/>
</f:facet>

<ice:outputText value="#{customer.homeDelivery}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Repair Service"/>
</f:facet>

<ice:outputText value="#{customer.repairService}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Trial Rooms"/>
</f:facet>

<ice:outputText value="#{customer.trialRooms}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Alteration Service"/>
</f:facet>

<ice:outputText value="#{customer.alterationService}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Hallmark Cerification"/>
</f:facet>

<ice:outputText value="#{customer.hallmarkCertification}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Made To Order"/>
</f:facet>

<ice:outputText value="#{customer.madeToOrder}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Installation Service"/>
</f:facet>

<ice:outputText value="#{customer.installationService}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Kids Area"/>
</f:facet>

<ice:outputText value="#{customer.kidsArea}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Snacks Counter"/>
</f:facet>

<ice:outputText value="#{customer.snacksCounter}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Hangout Area"/>
</f:facet>
>
<ice:outputText value="#{customer.hangOutArea}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Visa"/>
</f:facet>

<ice:outputText value="#{customer.visa}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Master Card"/>
</f:facet>

<ice:outputText value="#{customer.masterCard}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="American Express"/>
</f:facet>

<ice:outputText value="#{customer.americanExpress}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Diners Club"/>
</f:facet>

<ice:outputText value="#{customer.dinersCard}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="JCB Card"/>
</f:facet>

<ice:outputText value="#{customer.jcbCard}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="EMI"/>
</f:facet>

<ice:outputText value="#{customer.emi}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Cash On Delivery"/>
</f:facet>

<ice:outputText value="#{customer.cashOnDelivery}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Net Banking"/>
</f:facet>

<ice:outputText value="#{customer.netBanking}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="ATM Card"/>
</f:facet>

<ice:outputText value="#{customer.atmCard}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="International Credit Card"/>
</f:facet>

<ice:outputText value="#{customer.intlCreditCard}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Airtel Money"/>
</f:facet>

<ice:outputText value="#{customer.airtelMoney}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="SBI Freedom"/>
</f:facet>

<ice:outputText value="#{customer.sbiFreedom}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Sodexo"></ice:outputText>
</f:facet>

<ice:outputText value="#{customer.sodexo}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="PayMate"/>
</f:facet>

<ice:outputText value="#{customer.payMate}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="ItzCash"/>
</f:facet>

<ice:outputText value="#{customer.itzCash}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="OxiCard"/>
</f:facet>

<ice:outputText value="#{customer.oxiCard}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="ICashCard"/>
</f:facet>

<ice:outputText value="#{customer.icashCard}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Done Card"/>
</f:facet>

<ice:outputText value="#{customer.doneCard}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="ICashCard"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="PayBack"/>
</f:facet>

<ice:outputText value="#{customer.payBack}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point1"/>
</f:facet>
<ice:outputText value="#{customer.bp1}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point2"/>
</f:facet>
<ice:outputText value="#{customer.bp2}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point3"/>
</f:facet>
<ice:outputText value="#{customer.bp3}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point4"/>
</f:facet>
<ice:outputText value="#{customer.bp4}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point5"/>
</f:facet>
<ice:outputText value="#{customer.bp5}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point6"/>
</f:facet>
<ice:outputText value="#{customer.bp6}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point7"/>
</f:facet>
<ice:outputText value="#{customer.bp7}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point8"/>
</f:facet>
<ice:outputText value="#{customer.bp8}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point9"/>
</f:facet>
<ice:outputText value="#{customer.bp9}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Bullet Point10"/>
</f:facet>
<ice:outputText value="#{customer.bp10}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Main Image"/>
</f:facet>
<ice:outputText value="#{customer.mainImageUrl}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Main Image Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image1"/>
</f:facet>
<ice:outputText value="#{customer.image1Url}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image1 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image2"/>
</f:facet>
<ice:outputText value="#{customer.image2Url}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image2 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image3"/>
</f:facet>
<ice:outputText value="#{customer.image3Url}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image3 Caption"/>
</f:facet>
<!--<ice:outputText value="#{customer.}"></ice:outputText> -->
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image4"/>
</f:facet>
<ice:outputText value="#{customer.image4Url}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image4 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image5"/>
</f:facet>
<ice:outputText value="#{customer.image5Url}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image5 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image6"/>
</f:facet>
<ice:outputText value="#{customer.image6Url}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image6 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image7"/>
</f:facet>
<ice:outputText value="#{customer.image7Url}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image7 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image8"/>
</f:facet>
<ice:outputText value="#{customer.image8Url}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image8 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image9"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image9 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image10"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image10 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image11"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Image11 Caption"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Store video"/>
</f:facet>

</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Latitude"/>
</f:facet>
<ice:outputText value="#{customer.latitude}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Longitude"/>
</f:facet>
<ice:outputText value="#{customer.longitude}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Monday Open Time"/>
</f:facet>
<ice:outputText value="#{customer.time1}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Monday Close Time"/>
</f:facet>
<ice:outputText value="#{customer.time2}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Tuesday Open Time"/>
</f:facet>
<ice:outputText value="#{customer.time3}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Tuesday Close Time"/>
</f:facet>
<ice:outputText value="#{customer.time4}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Wednesday Open Time"/>
</f:facet>
<ice:outputText value="#{customer.time5}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Wednesday Close Time"/>
</f:facet>
<ice:outputText value="#{customer.time6}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Thursday Open Time"/>
</f:facet>
<ice:outputText value="#{customer.time7}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Thursday Close Time"/>
</f:facet>
<ice:outputText value="#{customer.time8}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Friday Open Time"/>
</f:facet>
<ice:outputText value="#{customer.time9}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Friday Close Time"/>
</f:facet>
<ice:outputText value="#{customer.time10}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Saturday Open Time"/>
</f:facet>
<ice:outputText value="#{customer.time11}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Saturday Close Time"/>
</f:facet>
<ice:outputText value="#{customer.time12}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Sunday Open Time"/>
</f:facet>
<ice:outputText value="#{customer.time13}"></ice:outputText>
</ice:column>

<ice:column>
<f:facet name="header">
<ice:outputText value="Sunday Close Time"/>
</f:facet>
<ice:outputText value="#{customer.time14}"></ice:outputText>
</ice:column>

<ice:column id="listcustomerIdId">
<f:facet name="header">
<ice:outputText value="Last Modified" />
</f:facet>
<ice:outputText value="#{customer.lastModified}" />
</ice:column>

</ice:dataTable>




In CustomerHome.java action class :-

public List<Customer> GetCustomerList()
{

List<Customer> customerListCH = new ArrayList<Customer>();


EntityManager em = (EntityManager)Component.getInstance("entityManager");

XPTIdentity identity = (XPTIdentity)Component.getInstance(XPTIdentity.class);

customerListCH = em.createQuery("select s from Customer s where s.serviceProviderId = "+identity.getServiceProviderId()+" ").getResultList();

return customerListCH;

}



Please share some ideas.
Thanks & Regards,
Srikanth N
 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use [c ode] tags.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tl;dr (too long; didn't read, if you're not up on Internet cant)

In other words, PLEASE don't post long examples when you can extract a smaller, simpler one that has the same issues.

Once a display gets too long to fit on a single screen, people stop looking at it.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!