Hi,

Use ERXJSConfirmPanel.

JSConfirmPanel uses a broken invokeAction implementation.

Sharpy.


> On 31 Aug 2022, at 11:34 pm, ocs--- via Webobjects-dev 
> <webobjects-dev@lists.apple.com> wrote:
> 
> Hi there,
> 
> bumped into a weird problem. I allow users to download a file, pretty 
> standard code
> 
> ===
>       WOActionResults downloadListing() {
>               WOResponse wor=new WOResponse()
>               wor.setHeader("application/pdf; 
> name=\"Listing\"","content-type")
>               wor.setHeader("attachment; 
> filename=\"Lisitng.pdf\"","content-disposition")
>               wor.setContent(... my data ...)
>               return wor
>       }
> ===
>       <wo:hyperlink action="$downloadListing">Get listing</wo>
> ===
> 
> This works like a charm. Nevertheless, the client wants to guard the download 
> by a JS alert; and if I change the template to
> 
> ===
>       <wo:JSConfirmPanel action="$downloadListing" 
> confirmMessage="Really?">Get listing</wo> 
> ===
> 
> I get this exception:
> 
> ===
> java.lang.ClassCastException: com.webobjects.appserver.WOResponse cannot be 
> cast to com.webobjects.appserver.WOComponent
> [2022-8-31 15:32:28 CEST] <WorkerThread1> java.lang.ClassCastException: 
> com.webobjects.appserver.WOResponse cannot be cast to 
> com.webobjects.appserver.WOComponent
>       at 
> com.webobjects.woextensions.JSComponent.invokeAction(JSComponent.java:87)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at 
> com.webobjects.woextensions.KeyValueCodingProtectedAccessor.methodValue(KeyValueCodingProtectedAccessor.java:32)
>       at 
> com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKeyValueCoding.java:1134)
>       at 
> com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueForKey(NSKeyValueCoding.java:1324)
>       at 
> com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1736)
>       at 
> com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCoding.java:447)
>       at 
> com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.valueForKeyPath(NSKeyValueCodingAdditions.java:212)
>       at 
> com.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:1804)
>       at 
> com.webobjects.appserver._private.WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java:50)
>       at 
> com.webobjects.appserver._private.WOGenericElement.invokeAction(WOGenericElement.java:121)
>       at 
> com.webobjects.appserver._private.WOGenericContainer.invokeAction(WOGenericContainer.java:27)
>       at 
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105)
>       at 
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115)
>       at 
> com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:1079)
> ... ... ...
> ===
> 
> How to fix the problem? Thanks!
> OC
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/getsharp%40gmail.com
> 
> This email sent to getsh...@gmail.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to