I have just made a portlet with web service for liferay to learn how it works. It's working fine, and the GET method via http is also working, although throwing exception because the database is empty, but it's ok.
So what I'm trying now is to full the data base from the same portlet by editing my view.jsp.
My question is, how or where should I put my code in the jsp to send a POST request to add a row in the database? I'd like to use the aui to show a field and a button, so that you write what you want to insert, click submit, and send the POST Request.
<%@ page import="javax.portlet.PortletPreferences" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<portlet:defineObjects />
<%
PortletPreferences prefs = renderRequest.getPreferences();
String name = (String)prefs.getValue("name", "Employee name");
%>
Please insert you new <b>Employee</b> name.
<form method="post">
<aui:form method="post">
<aui:input label="New Employee: " name="name" type="text" value="<%=name%>"/>
<aui:button type="submit" />
</aui:form>
</form>
This code is showing correctly the button and the field. I just want to know where I have to put the code and how, to send this request and store something in the DB:
serviceClassName:xxx.service.XServiceUtil
serviceMethodName:methodName
servletContextName:X-portlet
serviceParameters:["param1","paramN"]
param1:n
paramN:m
The web service is built and working.
Thank you very much,
Rafa