i know jsps/servlets/ejbs well; and have used tomcat and jboss as for a long
time. however, i am new jboss portal, and really new to portlets. i started
exploring with portlets this month. i started using jboss portal 2.0, and now
i am using jboss portal 2.2. do to my ignorance on the subject matter, i am
not sure if i discovered a bug in portal 2.0 that was fix in portal 2.2. or a
new bug in portal 2.2.
my env:
portal 2.0, jboss as 4.0.2, mysql 4.1
portal 2.2, jboss as 4.0.3, mysql 4.1
here is was I discovered:
What was done:
The TestRequestResponsePortlet sets two message in processAction. The first one
"message", uses request.setAttribute; the second one "message2" uses
response.setRenderParameter. In doView, thoses two messages are read. The first
one "message" is read with request.getAttribute. The second one is read with
request.getParameter.
The results:
When using JBoss Portal 2.0, both messages are pass thru, however when using
JBoss 2.2, only the second one "message2" is passed thru. Since these are
strings, response.setRenderParmeter / request.getParameter are fine to use.
however, if you need to pass an object other than a string, you have to use the
(set|get)Attribute.
if i am wrong, what ActionRequest/ActionResponse and
RenderRequest/RenderResponse methods do i use to pass object from the action to
the render in a portlet?
Here is my test portlet code
--------------------------------------------------------------------------------
package test.web.portlet;
import java.io.*;
import javax.portlet.*;
public class TestRequestResponsePortlet extends GenericPortlet
{
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException
{
request.setAttribute("message", "message from
TestRequestResponsePortlet.processAction using request.setAttribute");
response.setRenderParameter("message2", "message2 from
TestRequestResponsePortlet.processAction using response.setRenderParameter");
}//end method processAction
public void doView(RenderRequest request, RenderResponse response)
{
String message = (String)request.getAttribute("message");
String message2 = request.getParameter("message2");
PortletURL actionUrl = response.createActionURL();
String url = actionUrl.toString();
response.setContentType("text/html");
try
{
PrintWriter out = response.getWriter();
out.println("message = " + message + "");
out.println("message2 = " + message2 + "");
out.println("click the link below to see the results");
out.println("<h3><a href=\"" + url + "\">testing request response</h3>");
out.close();
}//end try
catch (IOException e)
{
e.printStackTrace();
}//end catch e
}//end method doView
}//end class TestRequestResponsePortletPortlet
--------------------------------------------------------------------------------
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3914275#3914275
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3914275
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user