Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Nicolas Tamayo
HttpSession from doView Method
January 26, 2013 11:03 AM
Answer

Nicolas Tamayo

Rank: Junior Member

Posts: 29

Join Date: October 3, 2012

Recent Posts

Hi All.

i Developed a Portlet that loads a Objects List in the View.jsp and this List is retrieved without Portal Database.

my solution is Save the List as HttpSession Parameter, but the Issue is that i can't call the HttpSession Object in DoView.

how i can call this object in this method?

or other solution that allow me save the Object in the view.jsp init?

thanks and regards.
Jelmer Kuperus
RE: HttpSession from doView Method
January 26, 2013 11:28 AM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

You can use the portlet session : portletRequest.getPortletSession();

But what you are doing is almost certainly a bad idea emoticon
Nicolas Tamayo
RE: HttpSession from doView Method
January 26, 2013 12:45 PM
Answer

Nicolas Tamayo

Rank: Junior Member

Posts: 29

Join Date: October 3, 2012

Recent Posts

Thanks for your quick reply.

thank for your apreciation, do you provide me a best idea to this.

the requirement is load a list in search container, the list is loades in each refresg of page, this means that te data source can vary from one view to another.

thanks a lot for you quick reply.

Note: still i need call the HttpSession, because i have a Attribute that save in the session in Login Process, i need this attribute to make the trieve Object List process. this object List is the list that i want show in the searchContainer

regards.
David H Nebinger
RE: HttpSession from doView Method
January 27, 2013 12:36 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7024

Join Date: September 1, 2006

Recent Posts

You're making assumptions here that are not correct. The login is part of the ROOT web application, and therefore your 'attribute' would be stored in it's http session. Your plugins have their own web application, and therefore have their own session.

Your first problem is trying to store this in the http session. Since you didn't indicate what the attribute is, it would be either something the user selects during login or a value that you derive based upon the user. If it is the former, instead you should think about using the user expando fields to store the value with the user (therefore it would be available everywhere), if it is something you derive from the user, then just use the derivation at the time the query must occur.

Second, you should not be doing retrieves on refresh. Portlet refreshes can occur many times, even if your portlet doesn't change. Instead you only do the retrieve during the action phase, and the render phase just does the render. That way you are only retrieving when you should, rather than for unrelated refresh activity.

Basically the portal environment should not be treated as a servlet environment. Any time you try to treat it that way, you are bound to get things just wrong.
Nicolas Tamayo
RE: HttpSession from doView Method
January 29, 2013 5:40 AM
Answer

Nicolas Tamayo

Rank: Junior Member

Posts: 29

Join Date: October 3, 2012

Recent Posts

Hi David

regarding treating the portal environment like servlet envronment, may be right. this is because of lack of practice.

regarding Expando Fields, you can provide me a link or reference that contains information for this.?

Thanks, Thanks a lot for your reply!!
Regards.

Note: the HttpSession Attribute that is saved for the User; is saved from Custom Login Portlet that was Developed to done de Authentication, and actually i able of done the retrieve operation of this Attribute from doView Method that belong to other portlet.