Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

need a help  RSS feed

 
krussi rong
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to do something to let user download some
datas from database.
The first problem:
I wrote code like this:
<a hef="download.jsp>download
and let download.jsp dynamically create data
file.(*.csv),then indirect to that file.hope
the browser give a save file window,
but the browser always open csv file.
The second problem:
I used this code:
<a href= "example.cvs"> download.
the first the click the "download"
the browser gave me a save file window,but the
second time the browser opened the file.
does anyone know how to solve the problem?
So, how should can I do about the function?
thanks.
Krussi
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please reread the naming policy and register with a proper name
www.javaranch.com/name.jsp
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hate to say but I have to confess. I don't have a habit of helping people who ignore requests. Sorry.
- satya
ps:
This seems to be the second friendly request urging you to follow the naming conventions and respect the dignity of the forums.
 
krussi rong
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I don't know how to do that.
when I click "register", it said you've already
log in.
thanks
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for asking.
I suggest first you logout. Then goto the
registration page and re-register.
Appreciate your cooperation.
- satya
ps:
Din't mean to be rude earlier, but it rubs me
on the wrong side.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satya's not the only one who answers faster when people aren't using a bogus name.
Check out the "Content-Disposition" header. It can be used to suggest to the user's browser an override to the default action that the browser would take (open or download).
The full details of how content-disposition is used are in one of the Internet RFC documents, but you can search the Servlets forum on JavaRanch as well.
http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=7&t=007028
 
mahadevan raja
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey,
the solution for ur second problem wud be like this,i think u had unchecked the checkbox,which says "Always ask before opening this type of file",while download.
It shud be checked.
this is the reason y it is opening the csv file directly,mind it ,it shud be checked.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!