Problem combining ice:commandButton with s:link for PDF download
[Logo]
Forums for ICEfaces and ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
Problem combining ice:commandButton with s:link for PDF download  XML
Forum Index -> JBoss Seam Integration Go to Page: Previous  1, 2
Author Message
nordmeyer

Joined: 18/08/2008 00:00:00
Messages: 13
Offline


Hi Judy,
thanks for your example and the link to the documentation. The documentation says, if working with jsf delegation, you can only use ICE: and core jsf tags. As we have any kind of tags spread throughout our app, jsf delegation still seams not to be a solution.

I Tried to understand your example but as it holds too plenty of files so I cannot find the clue.

I still think that my problem must have a quiet simple solution.
Can you say, what is going wrong?
Is there a problem on browser or server side of ICEfaces?
Is it a bug or does ICEfaces work as it's designed?

CU,
Thomas
nordmeyer

Joined: 18/08/2008 00:00:00
Messages: 13
Offline


Ups, somehow my reply did not find it's way to this thread. Trying again ...

---

Hi Judy,
thanks for your example and the link to the documentation. The documentation says, if working with jsf delegation, you can only use ICE: and core jsf tags. As we have any kind of tags spread throughout our app, jsf delegation still seams not to be a solution.

I Tried to understand your example but as it holds too plenty of files so I cannot find the clue.

I still think that my problem must have a quiet simple solution.
Can you say, what is going wrong?
Is there a problem on browser or server side of ICEfaces?
Is it a bug or does ICEfaces work as it's designed?

CU,
Thomas
jguglielmin

Joined: 20/07/2007 00:00:00
Messages: 181
Offline


I looked at that example (Samuel's) and it was for uploading and downloading files with the s:fileupload component, so I am a little confused. If you want to download a file (pdf or otherwise), you could use the <ice:outputResource> component (see latest seam-comp-showcase for that.

Perhaps you should attach your xhtml page and backing bean? I had thought you were trying to create the pdf dynamically.

Also note that ICEfaces 1.7.2 and onwards must disable the seam multipart filter as it interferes with the ice:inputFile component.

nordmeyer

Joined: 18/08/2008 00:00:00
Messages: 13
Offline


Hi Judy,
coming closer ...

Simplified, I've got two button-like elements on my xhtml-page:

Code:
<s:link value="Download" action="#{a_partnerbankAction.download()}" />
 
 <ice:commandButton action="#{a_partnerbankAction.findPartnerbank}" 
 value="Search"/>
 


a) Opening the page and Klicking "Search" calls my search-op an fills some table on my page - everything like expected.
b) Now Klicking on "Download" results in the browsers Save-Download-As Dialog (because my response has MimeType application/pdf) - everything like expected
c) Klicking "Search" again results in NOTHING.

Observing the "Network" page of Firebug on browser side shows me (new Entries in the list resulting from klick)

at a) POST http://localhost:8080/rwb/block/send-receive-updates
at b) POST http://localhost:8080/rwb/block/dispose-views
at c) -- NOTHING --

Is there an easy way preventing the s:link from disposing the views?

Uploading data is not in my focus. Downloading Files from disk neither. I just want do download content I generated with my application.

CU,
Thomas
jguglielmin

Joined: 20/07/2007 00:00:00
Messages: 181
Offline


Perhaps instead of s:link, you might try:-
Code:
     <ice:commandButton value="Download"  action="#{a_partnerbankAction.download()}">
          <s:conversationId/>
     </ice:commandButton>
 


which will do a form submission instead of an s:link which doesn't submit the form. Not sure what navigation you have in pages.xml for the action though. You might want to ensure that this isn't messing anything up too(?)
nordmeyer

Joined: 18/08/2008 00:00:00
Messages: 13
Offline


Nope. No download dialog opens. I Think, I need a HTTP-GET, not a POST.

But at least, ICE buttons stay alive.
jguglielmin

Joined: 20/07/2007 00:00:00
Messages: 181
Offline


OK. If you want the GET, then how about using Code:
<ice:outputLink>
with the view you want to redirect to (will perform the GET) and as a child include the conversationId tag from s:
nordmeyer

Joined: 18/08/2008 00:00:00
Messages: 13
Offline


Nope.
Trying
Code:
<ice:outputLink target="_blank" value="#{a_partnerbankAction.download()}">
   <ice:outputText value="Download"/>
   <s:conversationId/>
 </ice:outputLink>
 

the download starts as soon as I open the page and the page itself never gets displayed.
jguglielmin

Joined: 20/07/2007 00:00:00
Messages: 181
Offline


have you got a partialSubmit="true" on the form? (for it to start as soon as the page is displayed).

Do you have a simple test case for this you can attach here?
nordmeyer

Joined: 18/08/2008 00:00:00
Messages: 13
Offline


Hi Judy,
I tried to strip down my app to isolate the problem.
I still can't offer a simple test case - the simple extracts with ice:commandButton & s:link all seem to work properly.

What I found out by now is that the java side actions are still invoked properly (by ice:commandButton) after my s:link download. But the browser side view is never updated.

Continuing my researches ...

CU,
Thomas
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1043
Offline


Did you check out the javascript console (<ctrl><shift><t> using IE)?
nordmeyer

Joined: 18/08/2008 00:00:00
Messages: 13
Offline


I used to test with FF but tried IE now:

- click commandButton
=> everything works fine
- click s:link
=> download IE-popup opens - fine!
- click commandButton again
=> NPE (see attachment) and Seam Debug in Browser

The console output attached is a bit hard to read (sorry) because the clipboard skipped all line breaks.

CU,
Thomas
 Filename stacktrace.txt [Disk] Download
 Description Stacktrace of JBoss 4.2 GA (NPE)
 Filesize 12 Kbytes
 Downloaded:  51 time(s)

 Filename console-output-ie.txt [Disk] Download
 Description
 Filesize 5 Kbytes
 Downloaded:  50 time(s)

judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1043
Offline


Hard to glean much from those consoles, but you may want to put id's on your components to see what is causing the following :-Code:
Cannot set focus, no element for id [j_id44:j_id54]cannot find element with id: 'j_id44:j_id54'[window] :


Do you have push configured in your pop-up? How about just having a panelGroup with the rendered property attributed to some boolean of a simple backing bean? Then you can try this in synchronous perhaps without push. (just to simplify things).
 
Forum Index -> JBoss Seam Integration Go to Page: Previous  1, 2
Go to:   
Powered by JForum 2.1.7ice © JForum Team