I don't think you may do request forwarding from a portlet application
(but you can do redirects and includes).

So, instead of creating the download link via  a "command link" that
maps to an action listener that will handle the download, you use a
link that points to a servlet that will take the place of the action
listener for the download.  I know, it's not pretty, but it will work
and it's portable.

As Vlad has explained, you can simply output a link in your portlet's
rendered markup that is the URI to a servlet that is also a part of
your servlet/portlet web app.

So, to mimic Vlad's example, you put something like this in your
web.xml (where com.mycompany.servlet.MyDownloadServlet is the servlet
that will write the content to the output stream):

<web-app>
...
 <servlet>
   <servlet-name>documents</servlet-name>
   <servlet-class>com.mycompany.servlet.MyDownloadServlet</servlet-class>
   <load-on-startup>1</load-on-startup>
 </servlet>
...


 <servlet-mapping>
   <servlet-name>documents</servlet-name>
   <url-pattern>/documents/download.do</url-pattern>
 </servlet-mapping>
...
</web-app>

Then, if you output a link to /<web app
context>/documents/download.do, when a user clicks it, then the
content will be served by that servlet and you can then alter the
response headers and write binary content to the output stream from
within the servlet code.

The way you generate the actual link is irrelevant, you can use a JSF
tag (which I am not too familiar with), or you can simply write the
string directly (ie <%= myURIString  %>).

HTH,
aaron

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to