-
1. Re: want to send data from portlet
jlaskowski Jan 20, 2006 2:49 AM (in response to davinchi)Hi,
Use RequestDispatcher (RD) and request.setAttribute().public void doView (RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); request.setAttribute("myAttr", "myValue"); PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("another.jsp"); rd.include(request,response); }
The point is to set up the content type of a response (very likely it's text/html) *and* use RD.include() as forward() is not allowed.
BTW, You may find this and other answers in a very valuable book - http://www.manning.com/books/hepper. It's distributed at no charge (!)
--
Jacek Laskowski
http://www.laskowski.org.pl -
2. Re: want to send data from portlet
davinchi Jan 20, 2006 7:08 AM (in response to davinchi)thanks jacek,
But additionally if I on click of submit suppose I want to invoke a portlet.
I tried using the following command
PortletURL cancelUrl = aResponse.createRenderURL();
cancelUrl.setPortletMode(PortletMode.VIEW);
but these methods are not present in my jar.(I think they are specific to pluto)
How can I do the same in JBoss Portal -
3. Re: want to send data from portlet
jlaskowski Jan 20, 2006 7:37 AM (in response to davinchi)Hi,
You didn't read the book, did you? ;) Neither did I yet, but I'm pretty sure there's the answer. Anyway...
As you might've tried, you can include a jsp page into a portlet. So can you include a servlet, since a jsp is a servlet at runtime. Create a servlet-mapping (if it's not done for you automatically, e.g. /servlet/YourServlet) and include it into PortletRD as you did with the jsp.
--
Jacek Laskowski
http://www.laskowski.org.pl