Can anyone help me in implementing the download code link just like in this program as " Download this Program " .I am developing a web application using struts . In my application ,i have to return some PhP code to users with some input parmeters .My code will change with those parameters.First of all i will show the generated code in a text area .After that thers is a link 'saveas' .When user clicks the link , I have to serve them .php file,just like you are serving .java file in this tutorial. Please help me,I am thinking of passing the text in text area to a jsp where i can set content type as appliction/text .But its serving file as .jsp file.