I have made an JSR 168 portlet as follows:
public class GetTest extends GenericPortlet {
@Override
public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher("/getTest.jsp");
rd.include(request, response);
}
}
The portlet for this is named as getTest.portlet and is at WebContent folder. The jsp page for this:
<%
String params = request.getParameter("params");
out.print("Params: " + params);
%>
Now I want to make an Ajax get request to this portlet using DISC framework of Weblogic. How can I do this?
I searched on net regarding this but didnt any useful example which I can use. What I have tried is as follows:
in some other.jsp:
.....
<script type="text/javascript">
var dataUrl = "/getTest.portlet?params=hi";
var xmlhttp = new bea.wlp.disc.io.XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
alert(xmlhttp.responseText);
}
}
xmlhttp.open('GET', dataUrl, true);
xmlhttp.send(null);
</script>
....
In alert I get blank. I should get "Params: hi" as it is in jsp page of this portlet. How can I achieve this?
I read following articles but did not find anything useful or may be I missed something.
- http://docs.oracle.com/cd/E13155_01/wlp/docs103/clientdev/disc.html
- http://docs.oracle.com/cd/E13155_01/wlp/docs103/clientdev/rest.html
- https://blogs.oracle.com/satya/entry/new_feature_resource_serving_in
- http://docs.oracle.com/cd/E13155_01/wlp/docs103/clientdev/publishing.html
I have also enabled disc for the desktop portal in which this portlet is attached.