asked on liferay forum post
i trying make ajax request lifery portlet utilizing <portlet:resourceurl>
.
index.jsp
<portlet:resourceurl var="search" id="recordid"></portlet:resourceurl> <a href="#" onclick="ajaxcall('${search}')">click me</a> <script> var id = 100; function ajaxcall(ajaxurl){ $.ajax({ url : ajaxurl, data : { id: id }, type: 'get', datatype : "json", success : function(data) { // stuff on success }, error: function () { //do stuff on error console.log('error occurred'); } }); } </script>
and @controller
@controller @propertysource("classpath:application.properties") @requestmapping(value = "view") public class searchcontroller { @actionmapping public void handleactionrequest(actionrequest request, actionresponse response)throws exception { system.out.print("in action mapping handler"); return; } @rendermapping public modelandview handlerenderrequest(renderrequest request, renderresponse response, modelmap model) { return new modelandview("index", model); } @resourcemapping(value = "search") @responsebody public void getplan(resourcerequest request, resourceresponse response) throws portalexception, systemexception, ioexception { system.out.println("in search controller"); } }
however getting error , not sure why
org.springframework.web.portlet.nohandlerfoundexception: no handler found portlet request: mode 'view', phase 'resource_phase', parameters map[[empty]]
the request url:
http://localhost:8090/portal/web/mysite/home?p_p_id=myapp_war_myapp&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_resource_id=recordid&p_p_cacheability=cachelevelpage&p_p_col_id=column-1&p_p_col_count=1&id=100
any ideas?
@resourcemapping(value="recordid") work mentioned pankaj.