Foros de discusión

Liferay 6 contacting to a Custom Portlet class Method from JSP

Ravi Kiran, modificado hace 12 años.

Liferay 6 contacting to a Custom Portlet class Method from JSP

Junior Member Mensajes: 98 Fecha de incorporación: 12/12/11 Mensajes recientes
Hi ,

I have a Portlet named as VatPortlet .
I want to contact to a Particular method in it called as addUser

package com.test;

public class VatPortlet extends GenericPortlet {

public void addUser(ActionRequest request, ActionResponse response) {
String name = (String)request.getParameter("login");
System.out.println("addUser The Name is "+name);
}


}
From the JSP on click of the submit button , i need to contact this method
I have done this way , but its not working

<portlet:actionURL var="addUserURL" name="addUser">
</portlet:actionURL>


<form method="post" action="<%= addUserURL %>">
<h1>Please Login</h1>
Login: <input type="text" name="<portlet:namespace />login"><br>
Password: <input type="password" name="<portlet:namespace />password"><br>
<input type=submit value="Login">
</form>





could anybody please tell me
thumbnail
Sandeep Nair, modificado hace 12 años.

RE: Liferay 6 contacting to a Custom Portlet class Method from JSP

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
Since you are extending GenericPortlet you need to annotate the method as follows

@ProcessAction(name="addUser")
public void addUser(ActionRequest request, ActionResponse response) {

Note: Remove processAction if you have in your portlet Class

If you were extending your portlet class with MVCPortlet you dont have to add above annotation

REgards,
Sandeep
Ravi Kiran, modificado hace 12 años.

RE: Liferay 6 contacting to a Custom Portlet class Method from JSP

Junior Member Mensajes: 98 Fecha de incorporación: 12/12/11 Mensajes recientes
Could yo please tell me how to do without Annotations ??
thumbnail
Sandeep Nair, modificado hace 12 años.

RE: Liferay 6 contacting to a Custom Portlet class Method from JSP

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
Extend your class with MVCPortlet instead of GenericPortlet.

http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/developing-a-portlet-with-multiple-actions

Regards,
Sandeep