• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I reset the state of a Portlet

 
Anita Ganga
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a link on my page,on clicking that it takes me to the
portlet under consideration here. The purpose of the portlet is to search some text and return the results in a new results page.

Now let's say we want to search again on another text I click the original link but it still tries to display the search results page. There it fails

I understand that it is saving the state of the portlet. Am i right..If so
is there a way to reset the state so that it takes me to the first page where I can search for something again

Thanks in advance
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can turn of portlet caching in the portlet.xml file:

<expiration-cache>0</expiration-cache>

You may also need to play around with the cache headers in the HTML page.

There's not chance that the request parameters of the original search are being sent back is there? Are you sure it's a caching issue, and you're not actually invoking the original search somehow?

Cheers!

-Cameron
 
Anita Ganga
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cameron,

The second time I want to search something the logs show that it stills tries to load the search results page. And that is when it fails as it doesnot find text to be searched. That makes me think it is the portlet state resetting issue.

I tried this " portlet.state.reset=true " in ConfigService.properties. Even that didn't help.

Also I have the the expire cache set to 0 in portelt.xml.
There has got to be some simple solution for this...Appreciate Any further ideas
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do one thing put a back button on your search result page.
And put the your managed bean as session scope bean, so you will always see the data in your page. Then by clicking back button you can always goto search page and start new search.

If still it goes to same search criteria then somewhere you are storin your search criteria and not able to clean it, it is not portal problem.
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also, there are some methods, couple of them you already implemented to remove the state and go to initialized stated, but many of time they don't work as I tried with Websphere, so I advice not to change the state of the portlets as portlet meant for mainting state, instead of that provide some button to go to desired state.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic