i use jQuery.ajax to call this method in my portlet :
serveResource(ResourceRequest request, ResourceResponse response)
The problem is when i try to call any action(ActionRequest req,ActionResponse resp) or submit buttons,only serveResource is called .
To call serveResource i use in my jsp :
<portlet:resourceURL var="ajaxURL" >
<portlet:param name="jsp" value="<%=request.getPathInfo()%>" />
</portlet:resourceURL>
Why only and always this method is called when i call an other actions methods .
EDIT:
My Controller Code:
public class ConseillerPorlet extends MVCPortlet {
public void addConsultant(ActionRequest request,ActionResponse response){
List<String> errors=new ArrayList<String>();
ConseillerLocalServiceUtil.addConseiller(request, response);
SessionErrors.add(request, "error-saving-consultant");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void serveResource(ResourceRequest request, ResourceResponse response) throws IOException, PortletException {
String jsp=ParamUtil.getString(request, "jsp");
System.out.println("ServeResouce Called by "+jsp);
if(jsp.equals("/html/view.jsp")){
String s="";
List<Classe> classes;
long Id=ParamUtil.getLong(request, "id");
try {
classes=Utils.getListClasses(etablissementId);
for(Classe classe : classes)
{
s=s+"<option value='"+classe.getClasseId()+"'>"+classe.getNomClasse()+"</option>";
}
} catch (SystemException e) {
e.printStackTrace();
}
response.getWriter().write(s);//return options for my <select> that i get using ajax and jquery
}
}
}
Thanks for help