You are here

Getting the PortletRequest in a JSR 286 portlet

The PortletRequest contains a lot of information that you will often need. For example, you will use it to set and get parameters from it.
This little snippet shows you how you can retreive the PortletRequest

Snippet: 
  1. private PortletRequest getPortletRequest(){
  2.    FacesContext ctx = FacesContext.getCurrentInstance();
  3.    PortletRequest req =
  4.        (PortletRequest)ctx.getExternalContext().getRequest();
  5.    return req;
  6. }
Example: 
This example shows you how you can retreive the value of a portlet parameter:
  1. PortletRequest req = getPortletRequest();
  2. String value = req.getParameter("parameterName");
Applies to: 

Comments

Yannick

Can you please help us in this issue..

we are trying to send a parameter through URL to the wsrp portlet developed using webcenter PS3.

The requirement is - to capture a search string from the input text box created as part of the template located on all the webcenter pages..
we need to retrieve the portlet results page for the entered string..

I coulndt get any information related to this whether we can pass parameter to wsrp wsdl..or any other better way..

there was a reference to use public render parameters but how we do pass this from a page which is different from this portlet and these may or may not be in the same page

any help is greatly appreciated...

thanks very much in advance

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer