I am working on portlet for GateIn 3.6. Currently i have created a page that list the records in table. When user click on any row then it takes to description page.
Right now when user click on row it loads the details page but values are not available. What i am doing details are here..
@RenderMode(name = "view")
public void display(RenderRequest request, RenderResponse response) throws PortletException, IOException, NamingException {
RecordsDAO recordsDAO = new RecordsDAOImpl();
// Records listing available on listing page
request.setAttribute("recordsList", recordsDAO.getAllRecords());
// tried to load record detail page when user click one row
if(actionJsp == null || actionJsp.equals("")){
getPortletContext().getRequestDispatcher("/jsp/ListRecords.jsp").
include(request, response);
} else {
getPortletContext().getRequestDispatcher("/jsp/DetailsBoxRecord.jsp").
include(request, response);
}
actionJsp = "";
}
and the process action is
@ProcessAction(name = "details")
public void details(ActionRequest request, ActionResponse response) throws PortletException, IOException {
RecordsDAO recordsDAO = new RecordsDAOImpl();
int id = Integer.parseInt(request.getParameter("id"));
RecordsForm recordsForm = recordsDAO.getRecord(id);
// way 1 set request attribute
request.setAttribute("details", recordsForm);
// way 2 set response attribute -- display error that cannot set Form type values
response.setRenderParameter("details", recordsForm);
actionJsp = "values";
}
Option1: I have tried to set RecordsForm type values in request.setAttribute, its done but the values in request are not available in jsp page.
Option2: Using response.setRenderParameter I am not able to set RecordsForm type values in response.setRenderParameter to access these values in jsp page.
Can anyone please guide me which one is correct way in my case and how these values will be available in jsp page so i can load detail page.