Reputation: 7895
I have a app that perform some ajax updates on the page and uses a @ViewScoped ManagedBean. When the user submits the form, my action method redirects to a Jsp to display a chart using Cewolf library. It works ok, but it seems that the bean survives this redirect. If the user clicks the back button on the Jsp, all the 'rendered ajax' fields are blank, but the 'execute ajax' field displays the previous value. Then if i make a ajax update, the 'blank' fields are rendered with previous values...
The redirect code:
//save
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
Map<String, Object> sessionMap = externalContext.getSessionMap();
sessionMap.put("integrator", dataSource);
try
{
FacesContext.getCurrentInstance().getExternalContext().redirect("graph.jsp");
} catch (IOException ex)
{
Logger.getLogger(EquationsBean.class.getName()).log(Level.SEVERE, null, ex);
}
And some bit of my index.xhtml:
<h:selectOneMenu value="#{equationsBean.equationsToSolve}" id="neqs">
<f:selectItems value = "#{equationsBean.eqsChoose}" />
<f:ajax render="equationForm" execute ="neqs" listener="# {equationsBean.equationsSelected}"/>
</h:selectOneMenu>
What i expect is that when i redirect to the Jsp, my bean dies and the form is fresh if the user hits the back button. I already tried a filter to disable cache, but it behave very strangely. Also, i'm not using Jsp tags, only facelets, and some componentes have the 'rendered' attribute depending on my bean state. I should post the whole .xhtml, but it's a little big...
Thanks if someone can help me understanding this behavior!
Upvotes: 1
Views: 508
Reputation: 7895
Just found a better solution: using Primefaces, which didn't support XY charts but has a integration with JFreeChart.
Thanks anyway!
Upvotes: 1