This content has been marked as final.
Show 4 replies
-
1. Re: Open new window from modalpanel with commandlink
ilya_shaikovsky Jan 30, 2008 9:20 AM (in response to klaus.viehboeck)this construction is wrong from the beggining.. Click at this link wil generate two requests at one time one common and the other ajax one.
-
2. Re: Open new window from modalpanel with commandlink
klaus.viehboeck Jan 30, 2008 10:07 AM (in response to klaus.viehboeck)I forgot to say that i am trying to implement a download, where i call a Action method of a Handler that reads a binary file from the filesystem and writes it into the httpServletResponse.
i also tried another solution without the a4j:support tag<a4j:form> <a4j:commandLink id="buttonDownloadAusschreibungAgonto" value="Jetzt runterladen!!!" target="test" action="#{ausschreibungsdokumenteDownloadHandler.downloadAusschreibung}"> </a4j:commandLink> </a4j:form>
With this solution the Action Method is invoked and the file is processed. But instead of opening a file dialog, the Browser shows the binary code of the file.
So i tried to open a new windows with target attribute, that isnt generated in the HTML code
I use the following settings for the httpHeaderresponse.setContentType("application/x-download"); response.setHeader("Content-disposition", "attachment; filename=\"" + downloadName + "\""); response.setContentLength((new Long(srcdoc.length())).intValue()); response.setHeader("expires", "0");
which seems to be correct. So i supposed that i might have a problem with richfaces -
3. Re: Open new window from modalpanel with commandlink
sergeysmirnov Jan 30, 2008 10:40 AM (in response to klaus.viehboeck)Ajax is a replacing the part of the browser DOM tree without reloading the whole page.
So, you case is not suitable for Ajax. I just have to use the standard h:commandLink without any Ajax enhancements. -
4. Re: Open new window from modalpanel with commandlink
luis.miguel Jan 31, 2008 5:43 PM (in response to klaus.viehboeck)"klaus.viehboeck" wrote:
I am using a h:commandlink with the following code:<h:commandLink id="buttonDownloadAusschreibungAgonto" value="Jetzt runterladen!!!" target="test"> <a4j:support event="onclick" action="#{ausschreibungsdokumenteDownloadHandler.downloadAusschreibung}"></a4j:support> </h:commandLink>
but when i click the button no new Browserwindow is opened. When i look at the generated html code the "target" attribute of the generated <a/> tag is missing.
I use Firefox 2.0 by the way
I think that you should use this:<a4j:htmlCommandLink action="#{ausschreibungsdokumenteDownloadHandler.downloadAusschreibung}"/>