Thanks Stefan, but you will see I already posted a similar code :) It works 
well while showing it in the current window, but I'd want to find a way to show 
this response in a *new* window

--------------------------------------------------------

Renaud Denis ([EMAIL PROTECTED] )
Consultant

 
BSB Belgium (www.bsb.com) 
Avenue Athéna 2 - B-1348 Louvain-la-Neuve
T:+32 (0)10 48 79 63 - F:+32 (0)10 48 34 99
--------------------------------------------------------


-----Original Message-----

From: Meyer, Stefan [mailto:[EMAIL PROTECTED] 
Sent: jeudi 18 janvier 2007 9:42
To: [email protected]
Subject: AW: commandLink open new window

Writing into the response stream and bypassing the faces render phase goes like 
this:


FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) 
context.getExternalContext().getResponse();
response.setContentType("Content-type: text/csv");
response.setCharacterEncoding("ISO-8859-15");
response.setHeader("Content-disposition", "attachment;filename=" + 
"Report.csv");
response.getOutputStream().write....
// bypass the render phase
context.responseComplete(); 

-----Ursprüngliche Nachricht-----
Von: Renaud Denis [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 18. Januar 2007 09:32
An: [email protected]
Betreff: RE: commandLink open new window

I'm sorry Stephan, but I can't actually see how this solve my problem... ?

My purpose is to generate a non-faces response from a faces request (I mean, no 
link on a resource servlet or anything). It works well when producing the 
response in the same window but I cannot actually find an easy way to open this 
in a new window...

--------------------------------------------------------

Renaud Denis ([EMAIL PROTECTED] )
Consultant

 
BSB Belgium (www.bsb.com)
Avenue Athéna 2 - B-1348 Louvain-la-Neuve
T:+32 (0)10 48 79 63 - F:+32 (0)10 48 34 99
--------------------------------------------------------


-----Original Message-----

From: Meyer, Stefan [mailto:[EMAIL PROTECTED] 
Sent: mercredi 17 janvier 2007 12:11
To: [email protected]
Subject: AW: commandLink open new window

If you want to launch a modeless dialog from a link, you can do it this way:

                <h:outputLink  
onclick="window.open('','WindowName','width=700px,height=500px,resizable=true,scrollbars=yes');"
 destination="/popup.jsf" targetFrame="name">
                </h:outputLink> 

To parse the parameters I use the ViewController from shale. I use a non-faces 
request because the link is embedded in a tr:form whose target is the current 
window.


-----Ursprüngliche Nachricht-----
Von: Renaud Denis [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 17. Januar 2007 11:11
An: [email protected]
Betreff: RE: commandLink open new window

A question in the same context;

What if I want to generate a non-faces response from a faces request?

For example, showing a PDF file in a new window via a classic <commandLink />

--- Backing bean method

        public void download(ActionEvent event) {
                HttpServletResponse response = (HttpServletResponse) 
getExternalContext().getResponse();
                response.setContentType(this.getContentType());
                response.setBufferSize(this.getSize());
                
                try {
                        ServletOutputStream ostream =
response.getOutputStream();
                        byte[] content = this.getContent();
                        ostream.write(content);
                        ostream.flush();
                        
                        // Indicate to JSF Framework that the response has 
already been completed
                        // And it must skip the render response phase of the 
JSF lifecycle.
                        getFacesContext().responseComplete();
                } catch (IOException e) {
                        error("Download failed because of an I/O exception [" + 
e.getMessage() + "]");
                }
        }
---

--------------------------------------------------------

Renaud Denis ([EMAIL PROTECTED] )
Consultant

 
BSB Belgium (www.bsb.com)
Avenue Athena 2 - B-1348 Louvain-la-Neuve
T:+32 (0)10 48 79 63 - F:+32 (0)10 48 34 99
--------------------------------------------------------



BUSINESS SOLUTIONS BUILDERS DISCLAIMER
This e-mail message and any attachments are intended exclusively for the 
addressee(s) and may contain information which is confidential and/or protected 
by intellectual property rights. If you receive this e-mail by mistake, please 
notify immediately the sender, or Business Solutions Builders (by e-mail at 
[EMAIL PROTECTED]), and delete the message and any attachments without 
printing, copying or opening it. Any disclosure, reproduction, distribution or 
use of this message or any attachments, by persons other than the designed 
addressee(s), is strictly prohibited. E-mail transmission and Internet use 
cannot be guaranteed to be secure. Business Solutions Builders and its 
subsidiaries cannot be held responsible for any loss, delay or damage arising 
from their use.
--------------------------------------------------------

-----Original Message-----


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Matthias Wessendorf
Sent: samedi 13 janvier 2007 13:44
To: [email protected]
Subject: Re: commandLink open new window

useWindow="true"

outcome returns something like dialog:edit

  <navigation-rule>
    <from-view-id>/all.xhtml</from-view-id>
    <navigation-case>
      <from-outcome>dialog:edit</from-outcome>
      <to-view-id>/edit1.xhtml</to-view-id>
    </navigation-case>
  </navigation-rule>

-Matthias

On 1/12/07, Sabina Albu <[EMAIL PROTECTED]> wrote:
> Hi,
> I'm trying to open a new window using:
>
>
> <tr:commandLink action="#{backingBean.performOpenWindow}"
> target="_blank" text="Open new window" useWindow="false"
> windowWidth="800" windowHeight="500"></tr:commandLink>
>
> in my backing bean:
> public String performOpenWindow(){
>  ...
>  return "summaryView";
> }
>
> In my navigate.xml
> <navigation-case>
>             <from-outcome>summaryView</from-outcome>
>             <to-view-id>/pages/SummaryView.xhtml</to-view-id>
>             <redirect/>
> </navigation-case>
>
> Can someone point me to the right direction here.
>
> regards,
> Sabina
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Reply via email to