稱爲:的serveResource當我打電話我使用jQuery.ajax調用此方法在我的portlet操作
serveResource(ResourceRequest request, ResourceResponse response)
問題是,當我嘗試調用任何行動(的ActionRequest REQ,RESP ActionResponse的)或提交按鈕,只調用serveResource。
要調用的serveResource我在JSP中使用:
<portlet:resourceURL var="ajaxURL" >
<portlet:param name="jsp" value="<%=request.getPathInfo()%>" />
</portlet:resourceURL>
爲什麼只有始終當我調用其他操作方法,該方法被調用。
編輯:
我的控制器代碼:
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
}
}
}
感謝您的幫助
查看控制器代碼的其餘部分 – 2013-05-03 12:15:12
嗨,現在添加 – 2013-05-03 13:32:01