<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Passing String Parameter to javascript function in jsp is not working</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121389768" />
  <subtitle>Passing String Parameter to javascript function in jsp is not working</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121389768</id>
  <updated>2026-04-05T12:08:13Z</updated>
  <dc:date>2026-04-05T12:08:13Z</dc:date>
  <entry>
    <title>RE: Passing String Parameter to javascript function in jsp is not working</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121392930" />
    <author>
      <name>Gennaro Lippiello</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121392930</id>
    <updated>2022-04-05T18:31:28Z</updated>
    <published>2022-04-05T07:47:39Z</published>
    <summary type="html">&lt;p&gt;Hello, replace this&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;&amp;lt;% String data = &amp;quot;some data from database&amp;quot;; %&amp;gt;

javascript:onChangeCheckBox('&amp;lt;%= data %&amp;gt;')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;with&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;${data = &amp;quot;some data from database&amp;quot;}

javascript:onChangeCheckBox('${data}')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>Gennaro Lippiello</dc:creator>
    <dc:date>2022-04-05T07:47:39Z</dc:date>
  </entry>
  <entry>
    <title>RE: Passing String Parameter to javascript function in jsp is not working</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121393042" />
    <author>
      <name>Kunal Bhangale</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121393042</id>
    <updated>2022-04-05T18:30:38Z</updated>
    <published>2022-04-05T05:24:02Z</published>
    <summary type="html">&lt;p&gt;Thanks for your answer issue is now resolved&lt;/p&gt;</summary>
    <dc:creator>Kunal Bhangale</dc:creator>
    <dc:date>2022-04-05T05:24:02Z</dc:date>
  </entry>
  <entry>
    <title>RE: Passing String Parameter to javascript function in jsp is not working</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121392707" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121392707</id>
    <updated>2022-04-04T19:38:59Z</updated>
    <published>2022-04-04T19:38:59Z</published>
    <summary type="html">&lt;p&gt;If memory serves me right, having scriptlet in tags requires the
  whole value to be a scriptlet.&lt;/p&gt;
&lt;p&gt;E.g. instead of&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;&amp;lt;some:thing key=&amp;quot;some &amp;lt;%=&amp;quot;value&amp;quot;%&amp;gt;&amp;quot;/&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;you'd need&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;&amp;lt;some:thing key=&amp;quot;&amp;lt;%=&amp;quot;some &amp;quot; + &amp;quot;value&amp;quot;%&amp;gt;&amp;quot;/&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or similar&lt;/p&gt;</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2022-04-04T19:38:59Z</dc:date>
  </entry>
  <entry>
    <title>Passing String Parameter to javascript function in jsp is not working</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121389767" />
    <author>
      <name>Kunal Bhangale</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121389767</id>
    <updated>2022-04-04T16:37:51Z</updated>
    <published>2022-04-03T06:30:45Z</published>
    <summary type="html">&lt;p&gt;I have one JSP file This file contains some below code.&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;&amp;lt;%
    String data = &amp;quot;some data from database&amp;quot;;
%&amp;gt;
&amp;lt;aui:input type=&amp;quot;checkbox&amp;quot; name=&amp;quot;isOption&amp;quot; label=&amp;quot;isOption&amp;quot;  onChange=&amp;quot;javascript:onChangeCheckBox('&amp;lt;%= data %&amp;gt;');&amp;quot;&amp;gt;&amp;lt;/aui:input&amp;gt;
  
&amp;lt;script&amp;gt;
function onChangeCheckBox(input)
{
    console.log(&amp;quot;Input------------&amp;gt;&amp;quot;+input);
}
&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  &lt;br /&gt;   &lt;br /&gt;  &lt;br /&gt; When I have a checking or unchecked the
  checkbox from UI it will call the onChangeCheckBox function and print
  the input on the console.&lt;/p&gt;
&lt;p&gt;But instead of printing the actual string, it will be printing the
  below output on the console.&lt;/p&gt;
&lt;p&gt;Input------------&amp;gt;&amp;lt;%= data %&amp;gt;&lt;br /&gt;   &lt;/p&gt;</summary>
    <dc:creator>Kunal Bhangale</dc:creator>
    <dc:date>2022-04-03T06:30:45Z</dc:date>
  </entry>
</feed>
