David Newton wrote:
It went wrong in the fact that it doesn't work , I guessed with upper code , and hoped that it will work but it doesn't , it opened acrobat reader, but it show error not correct pdf file .
That is not enough information to help. "It shows an error" provides nothing that can be used to diagnose the problem. The rest of the action (that should, for example, be returning a "null" instead of an ActionForward) isn't displayed, so there's no way to know if that part of the application is correct. Have you verified that the PDF file is being created correctly? If so, that's useful information to provide, as it potentially eliminates another point of failure.
as far as I saw pdf file is correct , because when I copy it to my computer manually and try to open it is it opened with no errors or problems. Code which I provided in my first post is complete code inside this class , I only have imports at the beginning and that is it.
Like I said I am new to struts , so I am not sure if I set response in correct manner or not.
I am not sure if I understood what You meant by this
for example, be returning a "null" instead of an ActionForward)
should I modify method toPDF in a way that it doesn't return void but ActionForward , and then at the end of method to put return null ?