Hi,

I'm using this servlet mapping in the WEB-INF/web.xml
User don't know, that the file is generated from servlet, because it look like normal 
pdf 
file:)
Mozilla and IE don't use the part after the "?".

e.g.:
file web.xml:

   <servlet>
     <servlet-name>CreatePDFAllResultDocument</servlet-name>
     <display-name>Vysledkova listina pro pohlavi</display-name>
     <description>Zaverecna souhrna vysledkova listina pro dane pohlavi.</description>
     
<servlet-class>com.navrat.lezeni.servlet.CreatePDFAllResultDocument</servlet-class>
   </servlet>

   <servlet-mapping>
     <servlet-name>CreatePDFAllResultDocument</servlet-name>
     <url-pattern>/protected/vysl_list_prna.pdf</url-pattern>
   </servlet-mapping>

calling servlet from jsp:
I'm using some tags from Struts:)
file: /protected/vysl_list.jsp:

   <html:link href='<%="vysl_list_prna.pdf?zv_pohlavi=" + 
Zavodnik.MUZ%>'>pdf</html:link>


    Lumi

Nicolas Ivering wrote:
> Append the desired filename in the URL to the servlet like this:
> 
> http://www.myserver.com/servlet/com.hello.PDFServlet/mypdf.pdf
> 
> If you want the servlet to know the filename use getPathInfo() in 
> HttpServletRequest to get everything after the name of the servlet 
> ("/mypdf.pdf" in this case").
> 
> Regards
> 
> Nicolas
> 
> 
> Ramakrishna Kuppa wrote:
> 
>> Ram,
>>
>> As I mentioned in my posting, I have the disposition set to "inline" 
>> i.e.,
>> the doc. is opened directly in the browser. This is a requirement and 
>> cant
>> be changed. It is in this setting that I want to get the file name
>> correctly.
>>
>>
>>> -----Original Message-----
>>> From: Ram Guttikonda [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 
>>> October 08, 2002 4:07 PM
>>> To: Ramakrishna Kuppa; 'Robert Badaracco'; 
>>> [EMAIL PROTECTED]
>>> Subject: RE: [iText-questions] How to set the PDF file name?
>>>
>>>
>>> You might want to do something like this......
>>>
>>> HttpServletResponse _hsr = _requestContext.getResponse(); //get the 
>>> servlet response _hsr.setContentType("application/pdf");
>>> String disposition = "attachment; filename=" + <your filename>; 
>>> _hsr.setHeader("Content-disposition", disposition);
>>>
>>>
>>> Hope that helps.
>>>
>>> Cheers,
>>> Ram.
>>> -----Original Message-----
>>> From: [EMAIL PROTECTED]
>>> [mailto:[EMAIL PROTECTED]]On Behalf Of 
>>> Ramakrishna Kuppa
>>> Sent: Tuesday, October 08, 2002 1:09 PM
>>> To: 'Robert Badaracco'; [EMAIL PROTECTED]
>>> Subject: RE: [iText-questions] How to set the PDF file name?
>>>
>>>
>>> Bob,
>>>
>>> I generate the doc. dynamically and it opens in the (IE) browser 
>>> directly (inline). I am NOT writing to a file. The problem occurs 
>>> when I try to save this generated doc.
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Robert Badaracco [mailto:[EMAIL PROTECTED]]
>>>> Sent: Tuesday, October 08, 2002 1:06 PM
>>>> To: Ramakrishna Kuppa; [EMAIL PROTECTED]
>>>> Subject: Re: [iText-questions] How to set the PDF file name?
>>>>
>>>>
>>>> Define the path to your file as a String and then
>>>> declare a writer object like:
>>>>
>>>> PdfWriter writer = PdfWriter.getInstance(document, new 
>>>> FileOutputStream(filepath));
>>>>
>>>> Bob
>>>> --- Ramakrishna Kuppa <[EMAIL PROTECTED]>
>>>> wrote:
>>>>
>>>>> I am able to generate the file properly. However,
>>>>> when I try to save it
>>>>> using the "Save" button, the filename that appears
>>>>> is the long query string
>>>>> related to my generation servlet. How can I set the filename properly?
>>>>>
>>>>> Thanks
>>>>> Ramakrishna
>>>>>
>>>>>
>>>>>
>>>>
>>>> -------------------------------------------------------
>>>>
>>>>> This sf.net email is sponsored by:ThinkGeek
>>>>> Welcome to geek heaven.
>>>>> http://thinkgeek.com/sf 
>>>>> _______________________________________________
>>>>> iText-questions mailing list [EMAIL PROTECTED]
>>>>>
>>>>
>>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>>>
>>>>
>>>> __________________________________________________
>>>> Do you Yahoo!?
>>>> Faith Hill - Exclusive Performances, Videos & More
>>>
>>>
>>> http://faith.yahoo.com
>>>
>>>
>>> -------------------------------------------------------
>>> This sf.net email is sponsored by:ThinkGeek
>>> Welcome to geek heaven.
>>> http://thinkgeek.com/sf _______________________________________________
>>> iText-questions mailing list [EMAIL PROTECTED]
>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>>
>>
>>
>>
>> -------------------------------------------------------
>> This sf.net email is sponsored by:ThinkGeek
>> Welcome to geek heaven.
>> http://thinkgeek.com/sf
>> _______________________________________________
>> iText-questions mailing list
>> [EMAIL PROTECTED]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> 




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to