2016-06-07 6 views
0

gestellten auf dieses Forum Liferay gefunden postLiferay AJAX Anfrage: Kein Handler für Portlet-Anfrage

Ich versuche, eine AJAX-Anforderung von meinem Lifery Portlet zu machen <portlet:resourceURL> nutzen.

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) { 
         // do stuff on success 
       }, 
       error: function() { 
        //do stuff on error 
        console.log('Error Occurred'); 
       } 
     }); 
} 
    </script> 

Und mein @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 the 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 the search Controller"); 
     } 
} 

Jedoch habe ich die Störung erhalte und bin nicht sicher, warum

org.springframework.web.portlet.NoHandlerFoundException: No handler found for portlet request: mode 'view', phase 'RESOURCE_PHASE', parameters map[[empty]] 

Die Anforderungs-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 

Irgendwelche Ideen?

+1

Sie müssen als @ResourceMapping angeben (Wert = "recordId") –

Antwort

1

@ResourceMapping (Wert = "recordId") würde wie von Pankaj erwähnt funktionieren.