File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Passing correct image-file path in jsp to an embedded adobe flex component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Passing correct image-file path in jsp to an embedded adobe flex component" Watch "Passing correct image-file path in jsp to an embedded adobe flex component" New topic
Author

Passing correct image-file path in jsp to an embedded adobe flex component

Benjamin Weaver
Ranch Hand

Joined: Apr 08, 2003
Posts: 161
I have an application that embeds an image viewer, written in Adobe Flex, within a jsp page running in a J2EE application on Tomcat 5.5. The image viewer is founded and loaded in the output to the screen, but I cannot get the Image Viewer to display the image correctly, even though I succeed when either I run the .swf from the command-line or from an HTML page.

My webapp is called FRSApp. The directory structure is, under FRSApp:

myTest.html
jsp/catalog.jsp
pan_zoom_files/images/map.jpg


The JSP code is thus,



I have tried other paths to the image file, including

images/map.jpg [required by command-line execution of .swf]

pan_zoom_files/images/map.jpg [required by HTML page (myTest.html) that embeds the .swf file]



The error is either a "failed to load image" generated by the Image Viewer code, or a Flex system error message, resembling a null-pointer exception:


TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FIG_PanZoom_for_jsp()
at _FIG_PanZoom_for_jsp_mx_managers_SystemManager/create()
at mx.managers::SystemManager/initializeTopLevelWindow()
at mx.managers::SystemManager/docFrameHandler()



Any ideas are greatly appreciated!!
Benjamin Weaver
Ranch Hand

Joined: Apr 08, 2003
Posts: 161
Solved the problem. I had made several mistakes. One of them was to pass in the J2EE context path when what was needed was the fully qualified image url: http://localhost/FRSApp/pan_zoom_files/images/earth-map_small.jpg. The second mistake was to assume the flashvar variable could be picked up by initializing Action Script in the the mxml file. No, the flash variable will only be visible within the <mx:Application> </mx:Application> tags.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing correct image-file path in jsp to an embedded adobe flex component