<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
this is my .jsp
<portlet:defineObjects />
<form action='<portlet:actionURL/>' method="post">
<table>
<tr>
<td>subjectname:</td>
<td><input type="text" name="subjectname" /></td>
</tr>
<tr>
<td>degree:</td>
<td><input type="text" name="degree " /></td>
</tr>
<tr>
<td colspan=2><input type="submit" value="submit" /></td>
</tr>
</table>
</form>
this is my .java code
package com.test;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import com.test.model.student;
import com.test.service.studentLocalServiceUtil;
/**
* Portlet implementation class successtruePortlet
*/
public class successtruePortlet extends MVCPortlet {
public void init() {
viewJSP = getInitParameter("view.jsp");
}
public String subjectname;
public Long studentid;
public String degree;
public void processAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
long studentid=Long.parseLong(actionRequest.getParameter("studentid"));
String subjectname=actionRequest.getParameter("subjectname");
String degree=actionRequest.getParameter("degree");
actionResponse.setRenderParameter("jspPage","html/successtrueportlet/view.jsp");
try {
studentLocalServiceUtil.addstudent(studentid,subjectname,degree);
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
this is my XXXXlocalserviceimpl
public class studentLocalServiceImpl extends studentLocalServiceBaseImpl {
public student addstudent( long studentid,String subjectname,String degree) throws SystemException
{
student t = new studentImpl();
t = new studentImpl();
t.setStudentId(studentid);
t.setSubjectName(subjectname);
t.setDegree(degree);
return studentPersistence.update(t,false);
}
}
her is my code
but my portlet is displaying without text box and submit button and also tell me were to code for retriving data from database pls helpme!!
Be kell jelentkezni ahhoz, hogy ez helytelenként legyen megjelölve.