On 12/09/2013 05:47 PM, Matthias Wegner wrote:
Almost Perfect. I use now
{{velocity}} #if($request.getParameter("onsong")) #set($content=$request.getParameter("onsong")) $response.setContentType("text/plain"); $response.setCharacterEncoding('UTF-8') $response.setHeader("Content-Disposition", "attachment; filename=onsong.txt"); $response.writer.print($content.replace("/Newline/", "\n")) $context.setFinished(true); #end {{/velocity}}
{{html}} <form><button title="Download OnSong" type="submit" name="onsong" value="First Line/Newline/Second Line/Newline/Third Line"> <../../../resources/icons/silk/link_add.png> </button></form>
You shouldn't hardcode any URL. Use: $xwiki.getSkinFile('icons/silk/link_add.png')
{{/html}}
Do you know how i can breakline the string for the writer? \n does not work.
Velocity doesn't allow \n as an escape sequence, but you can use an actual newline: $response.writer.print($content.replace("/Newline/", " "))
Regards, Matthias
-- Sergiu Dumitriu http://purl.org/net/sergiu