Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how to display csv file directly in IE browser .

Have Programming Question? Ask it here!
 
 
 


somya pandab
how to display csv file directly in IE browser .
0 Answer(s)      2 years and a month ago
Posted in : Java Beginners


here is my code :

public String download(){
        if(log.isDebugEnabled()){
           log.info("Entered for downloading: ");
        }
        FacesContext facesContext = FacesContext.getCurrentInstance(); 
        ExternalContext externalContext = facesContext.getExternalContext(); 
        HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
        try{
            List<TableController> list = fetchTechniciansList();
            Iterator<TableController> iter = list.iterator();
            ServletOutputStream out = null;
            response.reset();`print("code sample");`
            response.setContentType("application/csv"); 
            response.setHeader("Cache-Control", "private"); 
            response.setHeader("Pragma", "public");
            response.addHeader("Accept-Ranges", "none");
            response.setHeader("Content-disposition","inline; filename=\""
                + "technician_list.csv" + "\"");
            out=response.getOutputStream();
            out.write("First Name".getBytes());
            out.write(',');
            out.write("Last Name".getBytes());
            out.write(',');
            out.write("User ID".getBytes());
            out.write('\n');
            Integer i=0; 
            while(iter.hasNext()) {             
                out.write(list.get(i).getFirst_name().getBytes());
                out.write(',');
                out.write(list.get(i).getBean_last_name().getBytes());
                out.write(',');
                out.write(list.get(i).getUser_id().toString().getBytes());
                out.write('\n');
                i++;            
                iter.next();
            }       
            out.flush();
            out.close();
            facesContext.responseComplete();


        }
        catch (Exception e) {
            // TODO: handle exception
            log.error("downloading error");
            log.info("Exited");
        }
        return null;
    }

I have command link in html :

<h:commandLink value="Download Technician List" action="#{tableControllerBean.download}" style="float:right" target="_blank"></h:commandLink>

which calls this download() method . the problem is that list open directly in excel file but not in IE . I am using IE 8 with windows 7.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
how to display csv file directly in IE browser .
how to display csv file directly in IE browser .  here is my code... open directly in excel file but not in IE . I am using IE 8 with windows 7...");` response.setContentType("application/csv"); response.setHeader("Cache-Control
how to display pdf file on browser
how to display pdf file on browser   In my project i have created one pdf file(by pdfwriter) into my local mechine . after that it need to display in browser as a pdf file . but in jsp i can't display by iframe tag can anyone
Advertisements
how to display the excel file in the web browser.
how to display the excel file in the web browser.  > %@ page import="java.io.InputStream" > %> <%@ page > import="org.apache.poi.xssf.usermodel.XSSFSheet"%> > <%@ page > import
How to write into CSV file in Java
How to write into CSV file in Java  How to write into CSV file... and the CSV file stores the value in the tabular form i.e. rows and columns... Object to PrintWriter instance. How to create File to CSV in Java
how to convert .xml file to csv file
how to convert .xml file to csv file  how to convert .xml file to csv file
how to parse a csv file using standard libraries?
how to parse a csv file using standard libraries?  hie i am a beginner in java i want to parse a csv file using any standard libraries i want to know how the libraries are imported and used in eclipse thanks in advance
how to display multiple images on browser
how to display multiple images on browser  i want to display multiple images on brower including string values from sql database using jsp
how to display multiple images on browser
how to display multiple images on browser  i want to display multiple images on brower including string values from sql database using jsp
how to dispaly pdf file on browser
how to dispaly pdf file on browser  In my project i have created one pdf file(by pdfwriter) into my local mechine . after that it need to display in browser as a pdf file . but in jsp i can't display by tag can anyone give me
how to export the query result in SQL Server to .csv file?
how to export the query result in SQL Server to .csv file?  how to write table data into CSV file using SQL SERVER 2008
How to Upload a file directly to Oracle database using JSP or Servlets?
How to Upload a file directly to Oracle database using JSP or Servlets?  Hi I want to upload a file(csv or excel) to Oracle 10g Database using JSP...;Upload File to Oracle Database</h2> <form id="form1" enctype
how to sort multiple key columns in CSV file - Java Beginners
how to sort multiple key columns in CSV file  Hi Any one can assist how to sort the multiple key columns in CSV file? Any example will be appreciated. Thanks
Java Write To File CSV
Java Write To File CSV In this tutorial you will learn how to write to file... a simple example which will demonstrate you how to write to csv file. To achieve... that is in a tabular form. In java to create a csv file is simple, you would require
Java Read CSV file
Java Read CSV file In this tutorial, you will learn how to read csv file. CSV... to break the line using ",". The delimiter for a CSV file is a comma.... Here is a csv file: Example import java.io.*; import java.util.*; public
how to capture IE browser FileDownload box open ,save and cancel event - JSP-Servlet
how to capture IE browser FileDownload box open ,save and cancel event ... on download button ,then we are writing file content in response object's output... in response object.B/C of this ,browser fileDownload dialog box comes.we need
sir, how to convert excel file to csv file using java? please send me sample code.
sir, how to convert excel file to csv file using java? please send me sample code.  please send me sample code for converting excel file into csv file uisng java
How to save form data to a csv file using jquery or ajax
How to save form data to a csv file using jquery or ajax  Please let... this. i am able to read the csv file using this code if (window.XMLHttpRequest...=data.responseText; Now the problem is ,i should write form data to a csv file using ajax
.csv file to databse
.csv file to databse  I have an 1 .csv file.. its having the url values like http://maps.google.com/?q=425+Bingeman+Centre+Drive%2c+chrompet%2c+ON%2c+600+006... q is request parameter .425 Bingeman Centre Drive is address
How to display a file for 24 hours?
How to display a file for 24 hours?  How to display a file for 24 hours
how to save html form data into .csv file using only jsp.
how to save html form data into .csv file using only jsp.  Dear all... into a .csv file using jsp. can anyone give me any sample solution or tutorial... inserted into the excel file. 1)Create form.jsp <html> <body> <form
Java code to executr db query if user directly closes the browser
Java code to executr db query if user directly closes the browser  How to execute a database query if the logged in user idle for 15 mins or he will directly close the browser.........PLS help it out
csv file download
csv file download  Hello Every one, when user clicks download button I want to retrieve data from mysql database table in csv format using java.if you know please send code. Thanks in Advance   Please visit
can u plz help out how to attach file directly & send to a particular mail id
can u plz help out how to attach file directly & send to a particular mail id  i am building a project online LEAVE MANAGEMENT SYSTEM to our coll... for approval so i need ur guidance how to tackle this problem
Export Database table to CSV File
Export Database table to CSV File In this tutorial, you will learn how to retrieve data from database and save it to CSV File. The Comma-separated values... similar to text files. Exporting or writing data to csv file is exactly same
reading a csv file from a particular row
reading a csv file from a particular row  how to read a csv file from a particular row and storing data to sql server by using jsp servlet
To Upload and insert the CSV file into Database
To Upload and insert the CSV file into Database... to upload a CSV file through JSP and insert it into the database. For this, we have...;TITLE>Display file upload form to the user</TITLE></HEAD> 
downloading a file directly from mysql using java
downloading a file directly from mysql using java  Hi, I am trying to come up with a code to download a file that is on a mysql database (in form of a blob) without using url. Can anyone tell me how it can be done because I am
Display PDF in browser - Struts
Display PDF in browser  Hi, I am trying to display the pdf file in the browser using struts 2. Here i am using iText for pdf generation... ON Browser")); document.close(); HttpServletResponse response
problem while reading .csv file
problem while reading .csv file  I have a problem here..... i am reading a .csv extention file which has some value....but the problem is der is an amount column which contains , in between (eg) 3,899.00 which inturns creates
How create csv format in jsf ?
How create csv format in jsf ?  Dear Friends , Good morning to all of you? I have a problem to create .CSV format in jsf. Actully I have... the pdf file now I want to create .csv format using this data ? Please Help me
how to display the output of the newly created excel file
how to display the output of the newly created excel file  the following program will create the test.xlsx file, how can i display the content of the test.xlsx file in the web browser? thanks, %@ page import
how to display the excel file content in the jsp
how to display the excel file content in the jsp  How to present the content of the newly created excel file in the following jsp to the web browser: print("code sample"); <%@ page import="java.io.InputStream" %>
How to load Arabic csv to MYSQL
How to load Arabic csv to MYSQL  I tried the following set session collation_database=utf8_general_ci; set session character_set_database=utf8... as "?????? ????????????????". I am sure that the csv file is encoded to utf8
How to Display jrxml file on JSP page???
How to Display jrxml file on JSP page???  I made jrxml file using jasper report but how to display on jsp page?? i tried lot but still i didnt find out solution.so pls help me as soon as possible
Exporting data from mysql to csv file
to export the data from mysql to csv file... i am having 30 columns in my database.. Eg- text1,text2,text3,....,upto text30... i want to export this data in csv file..if i export am getting the csv file with all data in one row.. but i want the csv
Export Data into CSV file uing JDBC in JSP
Export Data into CSV file uing JDBC in JSP       CSV file : A CSV file is commonly known...(); out.println("<b>You are Successfully Created Csv file.</b>
Export data into CSV File using Servlet
Export data into CSV File using Servlet  ... to Export data into  CSV file using Servlet. We have created  file "... description for the flow of application : A CSV file is commonly known as a Comma
how to sort the text file and display it in jtable
how to sort the text file and display it in jtable   my text file is: contig00001 length=586 numreads=4... ctgaggactcctcg i want to display the lines started with ">" symbol to be displayed
Expport data into CSV File using JDBC in Servlet
into CSV File using JDBC in Servlet   ... into CSV file using JDBC in Servlet. We have created  file "JdbcCsvFile.java" to export data from database in to CSV file. Brief
How send different files to browser at same time ..example(pdf&html) want display in same request using servlet
How send different files to browser at same time ..example(pdf&html) want display in same request using servlet  package com.readfiles; import...); } } }![alt text][1] [1]: http://How send different files to browser
php csv file uploding into mysql database table.
php csv file uploding into mysql database table.  hai friends, i... uploding csv file, i want to fetch the datas in corresponding fields in table. can any one help me how to write the coding. pls help me, i am doing final year
create csv file in php in multiple columns
create csv file in php in multiple columns  i need create csv file in multiple columns like this: id name age date_added 1 john 23 2012-2-12 2 jane 25 2012-3-14 i can build csv file like this: id,name,age,date
create csv file in php in multiple columns
create csv file in php in multiple columns  i need create csv file in multiple columns like this: id name age date_added 1 john 23 2012-2-12 2 jane 25 2012-3-14 i can build csv file like this: id,name,age,date
Download CSV File from Database in JSP
){ e.printStackTrace(); } %> Output: Display CSV file... Download CSV File from Database in JSP  ... a webpage "viewcsv.jsp""  to display and download the CSV
java, upload csv file - Development process
java, upload csv file  hi, i have a csv file having 29 colums, i want to upload that csv file to database. i need the code,, can u please send me the code.. thanks..  Hi Friend, Please visit the following
how to display data from jsp file into database
how to display data from jsp file into database  this is a jsp file . look at the line with code-> Statement st=con.createStatement(); in the below example. the error is "cannot convert from java.sql.Statement
convert .txt file in .csv format - Java Beginners
file and I should be able to display contents of the .csv file. This is what I...convert .txt file in .csv format  Dear all, I hope you are doing good. I am looking to convert .txt file in .csv format. The contents might have
php download file browser
php download file browser  limiting downloading file system via browser only through my web application
Convert CSV to excel File - Java Beginners
Convert CSV to excel File  Sir, i have CSV file as input. I need to convert that CSV file to excel file and format. Currently i am using HSSF POI api to format the excel file. Here i am unable to read the data from the CSV
Retrieve Data from CSV file in JSP
Retrieve Data from CSV file in JSP       CSV file : A CSV file is commonly known as a Comma... a Page ("ReadCsvFile.jsp") to retrieve the data from CSV file "
 

 

 

DMCA.com