Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Kiran Jai
Liferay 6 : Not allowed in event phase when using Jquery AJAX with Liferay
17 de abril de 2012 5:08
Respuesta

Kiran Jai

Ranking: Junior Member

Mensajes: 38

Fecha de incorporación: 9 de abril de 2012

Mensajes recientes

I am using Liferay 6 and Jquery with AJAX Support

Enter Your Name:

This is my function called on click of that button

function my_button_handler()
{
jQuery.ajax({
type: "POST",
url: "helloForm",
success: function(msg){
alert( "Data Saved: " + msg );
}});

}

This is my Struts2 Action class

public String execute() throws Exception {
HttpServletResponse response = ServletActionContext.getResponse();
writer.print("Hi");
return ActionSupport.SUCCESS;
}

This is my action mapped inside struts.xml file

<action name="helloForm" class="com.robisoft.portlet.struts.action.Struts2Action">
<result name="input">/WEB-INF/view/index.jsp</result>
<result name="success">/WEB-INF/view/result.jsp</result>
</action>

Where the result.jsp is a empty blank page only

When i executed this , by clicking on that button , it started giving me this Exception under server console

11:58:46,368 ERROR [render_portlet_jsp:154] java.lang.IllegalStateException: Not allowed in event phase
at org.apache.struts2.portlet.servlet.PortletServletResponse.getWriter(PortletServletResponse.java:169)
at com.robisoft.portlet.struts.action.Struts2Action.execute(Struts2Action.java:56)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)

Please tell me what might be the issue ??
Jignesh Vachhani
RE: Liferay 6 : Not allowed in event phase when using Jquery AJAX with Life
17 de abril de 2012 5:41
Respuesta

Jignesh Vachhani

Ranking: Liferay Master

Mensajes: 785

Fecha de incorporación: 10 de marzo de 2008

Mensajes recientes

Hi Kiran,

You can see this post Here for more details about ajax call.
Hope this will give idea about how you can use jQuery Ajax call in liferay.