Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get the paramaters from one jspportlet into another portlet

 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i have a jsp portlet with 2 textfields by names username,pwd and i want to get the paramaters into another portlet.any body please help
thanks in advance
saiprasanna
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Communication between the portlets can be done by Presentation Context.

Secondly you can aso do the samething by providing the listeningTo

attribute of one portlet as the portlet id of second one.

Naseem
 
GaneshKumar Kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sai,
If the two portlets are in the same Application you can do this.
Get the text box entries from the jsp. Store the values in the PortletSession in your Portlet class. Use Application scope for the session.
Get the attributes from the PortletSession in the second portlet.

Thanks.
Ganesh
 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Naseem and Ganesh
can we use Page Flow concept in the above scenario and
we are using weblogic portal 9.2 for portlets iam new to portlets can you provide step by step process to accept parameters
regards
prasanna
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sai prasanna
i have a jsp portlet with 2 textfields by names username,pwd and i want to get the paramaters into another portlet.any body please help



With two text fields username and password, jpf portlet is better. Why you are creating jsp portlet for that.

Create a jpf portlet. After the rendering of the portlet, From its begin action, forward to login.jsp. There you will allow user to enter username and password details. On submission, call say process action of same jpf. In process action, you need to retrieve the request parameters using getRequest() method.

Then set login details in outer request so that other non-page flow portlet like a jsp portlet which are not the part of page flow can get it from request.

with request scope, only jsp and actions which are part of page flow can retrive it from request scope. However, if you want to get it in a different portlet which is definitely not a part of this page flow, then you require outer request.

How will you create an instance of outerRequest here is the code....



Hope this will help

Naseem
 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you provide an url related to above
thanks Naseem
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no book in India or any url you an find what I told you. bea online help is the ony resource which you have already posted. I purchased one book from US and that was on Weblogic workshop. That book covers to some extent weblogic portal things.

Naseem
[ July 20, 2006: Message edited by: Naseem Khan ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jpf portlet" Yes, but jpf is proprietary of BEA, so if you use it you are now vendor locked. jpf is not defined in the Portlet Spec.

If you put the attribute into the Application scope from one portlet, you must remember that it will only be there for the other portlet if the processAction of the first portlet is called, if a different Portlet on the page has their processAction called, then the attribute will not be there for the other Portlet.

Mark
 
GaneshKumar Kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sai,
You can refer this example.
consider CityPortlet and WeatherPortlet, two portlets in the same application.

In processAction() of CityPortlet:
portletSession.setAttribute("cityName", newCityName, PortletSession.APPLICATION_SCOPE);
In the WeatherPortlet, you can retrieve the changed city name by getting it from the PortletSession:

In doView() of WeatherPortlet:
currentCityName=(String)portletSession.getAttribute("cityName",PortletSession.APPLICATION_SCOPE);

Remember the following from Mark's reply
If you put the attribute into the Application scope from one portlet, you must remember that it will only be there for the other portlet if the processAction of the first portlet is called, if a different Portlet on the page has their processAction called, then the attribute will not be there for the other Portlet.

Thanks.
Ganesh
 
pooja jain
greenhorn
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Naseem Khan:
Communication between the portlets can be done by Presentation Context.

Secondly you can aso do the samething by providing the listeningTo

attribute of one portlet as the portlet id of second one.

Naseem


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic