Foros de discusión

How To Include XHTML content using Servelet inside the Portlet Content

Tentu Poli Naidu, modificado hace 15 años.

How To Include XHTML content using Servelet inside the Portlet Content

New Member Mensajes: 10 Fecha de incorporación: 17/03/09 Mensajes recientes
Hi ,

I have to include the .xhtml file using the servlet class in portlet content in liferay.

Could you please help me to solve this issue.

Here is my sample code.

doView method code in the portlet class.

protected void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException {
PortletRequestDispatcher portletrequestdispatcher = getPortletContext().getRequestDispatcher(
"/controllerServlet");
portletrequestdispatcher.include(renderRequest, renderResponse);
}

Servlet doGet method of the controller servlet code.

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {

PrintWriter out = res.getWriter();

boolean isQuoteHasErrors = false;
if( !isQuoteHasErrors ){
req.getRequestDispatcher("/quote/quoteConfirmation.xhtml").forward(req, res);
}
}

But if i directly access the servlet by typing the url pattern in the browser then i am able include the xhtml page as a web page but not inside the portlet content.