This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes file name issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "file name issue" Watch "file name issue" New topic
Author

file name issue

gendhe ranjith kumar
Greenhorn

Joined: Mar 28, 2011
Posts: 20
i have one requirement

read the content from database and store it into excel file save it as like "Summary balance sheet".

i am using the following code

response.setContentType("application/vnd.ms-excel; charset=UTF-8");
response.addHeader("content-disposition", "inline; filename=" + resultXLS);
it does not taken the entire string as file name
it takes only Summary as file name.

the file name should be sumary balance sheet.

is there any other way to set the file name in jsp
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4338
    
    7

Try putting quotes around the filename in the header. Something like:
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Don't put a space in the file name, so use SummaryBalanceSheet.xls
Pete Nelson
Ranch Hand

Joined: Aug 30, 2010
Posts: 147

One thing I am confused on - if you want the user to save the file, why set the content-disposition to "inline" (display in the browser)? Wouldn't "attachment" be the correct value if the intent is for the user to save the file?


OCPJP
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
 
 
subject: file name issue
 
Similar Threads
Copying a sheet from an excel file to another excel file using Apache POI
How to create New Excel File
display of japanese characters in Excel report
spredsheet should disply the dynamic data
xsl-region-body using content from body. Is this possible?