Hi, I am currently attempting to utilize Ajax with Spring Mvc Portlet in Liferay. I have a JSP file and Controller Class set up. My goal is to insert data into a form, but for some reason, my controller class is not being called when I click the submit button. Can someone please assist me in resolving this issue?
Here is an excerpt of my .jsp code:
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects/>
... (JSP code continues) ...
And here is part of my JavaScript code:
$('#saveBigForm').click(function(){
var json = $('#bigForm').jqDynaForm('get');
showFormJson(json);
$.ajax({
type: "POST",
url : "${actionOneMethodURL}",
data: JSON.stringify(json),
dataType: "json",
success: function(response){
if(response.status == "SUCCESS"){
$('#info').html("Success! Request has been added.");
} else {
$('#info').html("Sorry, there is something wrong with the data provided.");
}
},
error: function(e){
alert('Error: ' + e);
}
});
});
Finally, here is an overview of my controller class:
package com.myowncompany.test.springmvc.controller;
import java.io.IOException;
... (Controller class definition continues) ...
I have encountered the following logs:
09:36:56,291 INFO [DispatcherPortlet:119] Portlet 'firstspringmvc' configured successfully
09:36:56,300 INFO [localhost-startStop-19][PortletHotDeployListener:454] 1 portlet for first-spring-mvc-portlet is available for use
10:09:49,460 WARN [http-bio-9090-exec-138][404_jsp:121] {msg="/$%7BactionOneMethodURL%7D", uri=/$%7BactionOneMethodURL%7D}
10:09:54,325 WARN [http-bio-9090-exec-139][404_jsp:121] {msg="/$%7BactionOneMethodURL%7D", uri=/$%7BactionOneMethodURL%7D}