Avatar of david_sl
david_sl
 asked on

Call Java method from Javascript (in XSL)

In my XSL, I am calling a Javascript method. From this Javascript method, I need to call a Java method. Please let me know how to do this.
If I simply write this in javascript
                                    java_func_1:fileViewer('0900054d8000cf8e');
it does not work


xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java_func="com.common.utils.SUtils"
xmlns:java_func_1="com.components.detailedView.FkDetailedView"
extension-element-prefixes="java_func java_func_1" version="2.0">
....
<xsl:template match="/">
     <html>
         <head>
            <script language="javascript">
				<![CDATA[
				function displayFile() {
				    alert("works");
                                    java_func_1:fileViewer('0900054d8000cf8e');
				}
				]]>
		    </script>
         </head> 
         <body>
        <xsl:apply-templates />
         </body>
     </html>
    </xsl:template>
...
...
             <tr  class="row1">
                 <td>
                     <xsl:for-each select="fb_holder/attached_files/file_details">
                        <a href="#" onclick="javascript:displayFile();"><xsl:value-of select="file_name"/></a><br/>
                    </xsl:for-each>
                </td>
            </tr>

Open in new window

Web Languages and StandardsJavaScriptJava

Avatar of undefined
Last Comment
Mick Barry

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mick Barry

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
david_sl

ASKER
Thanks.
But i need to call Java from a Javascript method
Mick Barry

the link above explains how.
Javascript is run in the browser so the only java classes available to it in applets on the page

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy