Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to call Struts2 Action using Jquery Ajax in Liferay
    primarykey
    data
    text
    <p>I was Unable to call Struts2 Action using Jquery Ajax in Liferay6.1</p> <p>Please see the following files , i pasted below and let me know if this is not the way to call </p> <p><strong>Jsp page</strong></p> <pre><code>&lt;portlet:renderURL var="getChartData" windowState="&lt;%= LiferayWindowState.EXCLUSIVE.toString() %&gt;"&gt; &lt;portlet:param name="struts_action" value="/getChartData" /&gt; &lt;/portlet:renderURL&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ alert('jjjj'); $.ajax({ type : 'POST', url : '&lt;%=getChartData%&gt;', data: "countryId="+countryId, success : function(data){ alert(data); } }); }); &lt;/script&gt; </code></pre> <p><strong>struts.xml</strong></p> <pre><code>&lt;action name="getChartData" class="com.actions.ImageDisplayAction" method="getChartData"&gt; &lt;result name="success"&gt;/WEB-INF/view/blank.jsp&lt;/result&gt; &lt;/action&gt; </code></pre> <p><strong>portlet.xml</strong> </p> <pre><code>&lt;portlet&gt; &lt;portlet-name&gt;DisplayImages&lt;/portlet-name&gt; &lt;display-name&gt;DisplayImages&lt;/display-name&gt; &lt;portlet-class&gt;org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher&lt;/portlet-class&gt; </code></pre> <p>Action class</p> <pre><code>public class ImageDisplayAction extends ActionSupport { public String getChartData() { System.out.println("Hi "); System.out.println("Hi "); System.out.println("Hi "); System.out.println("Hi "); return SUCCESS; } } </code></pre> <p>Updated part :</p> <p>I am not getting any Exception , here is my complete struts.xml file</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"&gt; &lt;struts&gt; &lt;constant name="struts.multipart.saveDir" value="D:\\ant" /&gt; &lt;package name="view" extends="struts-portlet-default"&gt; &lt;action name="index" &gt; &lt;result name="input"&gt;/WEB-INF/view/index.jsp&lt;/result&gt; &lt;result name="success"&gt;/WEB-INF/view/index.jsp&lt;/result&gt; &lt;/action&gt; &lt;action name="getChartData" class="com.actions.ImageDisplayAction" method="getChartData"&gt; &lt;result name="success"&gt;/WEB-INF/view/blank.jsp&lt;/result&gt; &lt;/action&gt; &lt;/package&gt; &lt;/struts&gt; </code></pre> <p><strong>This is inside my JSP file (No chnages )</strong></p> <pre><code>&lt;portlet:renderURL var="getChartData" windowState="&lt;%= LiferayWindowState.EXCLUSIVE.toString() %&gt;"&gt; &lt;portlet:param name="struts_action" value="/getChartData" /&gt; &lt;/portlet:renderURL&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ alert('jjjj'); $.ajax({ type : 'POST', url : '&lt;%=getChartData%&gt;', data: "countryId="+countryId, success : function(data){ alert(data); } }); }); &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload