<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to call HTML dialog's method from java</title><link>https://answers.axonivy.com/questions/4230/how-to-call-html-dialog-s-method-from-java</link><description>&lt;p&gt;Dear Ivy team
I would like to know is there any way to trigger a HTML dialog from java code.
Lets me describe the situation:
I have a page that contains a method named "run"
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/2019-12-04_16h47_35.png"&gt;&lt;/p&gt;
&lt;p&gt;In HTML view I have a button to call a method from backing bean "Bean"
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/2019-12-04_16h48_42.png"&gt;
Now what we need to how to trigger method "run" from the backing bean
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/2019-12-04_16h49_17_Xq1duAv.png"&gt;&lt;/p&gt;
&lt;p&gt;We can achieve this only when the method belongs to an Ivy component by using something like this
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/2019-12-04_16h52_34.png"&gt;
Unfortunately, this way only work for Ivy's component, not for the page. 
So my question is do we have any way to call HTML dialog's method from java?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/4230/how-to-call-html-dialog-s-method-from-java" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 06 Dec 2019 03:44:51 -0500</lastBuildDate><item><title>Answer by Lukas Lieb</title><link>https://answers.axonivy.com/questions/4230/how-to-call-html-dialog-s-method-from-java/4248</link><description>&lt;p&gt;Hmm... You may try to run an EL expression from you java bean like this: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FacesContext context = FacesContext.getCurrentInstance();
FacesContext.getCurrentInstance().getApplication().evaluateExpressionGet(context, "#{logic.run()}", String.class);
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Lukas Lieb</dc:creator><pubDate>Fri, 06 Dec 2019 03:44:51 -0500</pubDate><guid>https://answers.axonivy.com/questions/4230/how-to-call-html-dialog-s-method-from-java/4248</guid></item><item><title>Comment by hieulam on hieulam's question</title><link>https://answers.axonivy.com/questions/4230/how-to-call-html-dialog-s-method-from-java#4241</link><description>&lt;p&gt;Thank Lukas for your suggestion. Moving the logic from ivy script to bean works for me but impossible in my situation because the method from HTML dialog contains a whole workflow with many ivy's elements. That means moving HTML dialog method to java is impossible&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">hieulam</dc:creator><pubDate>Thu, 05 Dec 2019 21:20:28 -0500</pubDate><guid>https://answers.axonivy.com/questions/4230/how-to-call-html-dialog-s-method-from-java#4241</guid></item><item><title>Comment by Lukas Lieb on hieulam's question</title><link>https://answers.axonivy.com/questions/4230/how-to-call-html-dialog-s-method-from-java#4236</link><description>&lt;p&gt;Did you consider to write the run method in this bean (ivy script content in the bean method run)? With this approach you can run this method easily from the bean and from the htmldialog too (e.g #{bean.run()})&lt;/p&gt;
&lt;p&gt;Kind regards lukas&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Lukas Lieb</dc:creator><pubDate>Thu, 05 Dec 2019 09:48:36 -0500</pubDate><guid>https://answers.axonivy.com/questions/4230/how-to-call-html-dialog-s-method-from-java#4236</guid></item></channel></rss>