Zaheer Baloch
Zaheer Baloch

Reputation: 536

How to pass and get URL parameters in IBM Webpshere Portal 6.1 JSF Portlets?

I have a simple HTML page which contains a form (uses GET method), whose action is a portal page containing a JSF portlet. I need to access the parameters passed in to the portal page in my portlet - how can I achieve this?

I have tried to access the parameter code on the view page using following code but the value comes up as null.

java.util.Map requestMap = javax.faces.context.FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); 
String code = requestMap.get("code");

At some other forum it was suggested that I need to pass the the portlet id as request parameter in order to have the portlet access to passed request parameters. If that is true where/how can I lookup my portlet ID so that portlet has access to request parameters?

Upvotes: 2

Views: 4347

Answers (2)

JohnD
JohnD

Reputation: 1

See my article Passing query parameters to JSR-286 portlets here.

I know this is a supported way to do it. I have seen other articles that claim you can simply cast the PortletRequest to something and get the parameters. This is probably not supported in that it depends on a particular implementation and reference to an internal class name. I recommend the above.

Upvotes: 0

McDowell
McDowell

Reputation: 108859

I would look into whether the WebSphere implementation of public render parameters supports this. If the ExternalContext request parameter map does not expose these values, you can cast the request to a PortletRequest and make use of the Map<String,String[]> getPublicParameterMap() method.

Upvotes: 3

Related Questions