Browse back button issue
thiagu.m Apr 3, 2008 2:20 PMHi every one
i have the same problem what they discussed here
My Link
http://solutionsfit.com/blog/2007/11/08/alleviating-client-side-back-button-issues-with-ajax4jsf-and-richfaces/
i try the workaround code , but i cant fix the problem
this is what i am try .
1. The following is my code for a home page.
<body onload="reloadAjaxPanels()">
<a4j:form id="form">
<a4j:jsFunction name="reloadAjaxPanels" reRender="panelToReload" />
<a4j:outputPanel id="panelToReload">
<h:selectManyCheckbox id="Brand" value="#{search.brand}" >
<f:selectItems value="#{brandItems}"/>
<a4j:support event="onclick" reRender="form"/>
</h:selectManyCheckbox>
<rich:dataTable rows="10" id="ver" value="#{prodlis}" var="category">
<h:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Product Name" />
</f:facet>
<h:outputText value="#{category.productName}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Brand" />
</f:facet>
<h:outputText value="#{category.brand}" />
</h:column>
</rich:dataTable>
<rich:datascroller ajaxSingle="false" for="ver" maxPages="4" />
</a4j:outputPanel>
</a4j:form>
</body
2. This is my session bean code
package session.beans;
import static org.jboss.seam.ScopeType.CONVERSATION;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.faces.model.SelectItem;
import javax.persistence.EntityManager;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.web.RequestParameter;
import entity.beans.TblProducts;
@Stateful
@Name("search")
public class homeAction implements Home, Serializable{
@In EntityManager entityManager;
@RequestParameter
BigDecimal hid;
@Out(required=false)
List<TblProducts> prodlis;
List<TblProducts> temp;
@Out(required=false)
List<SelectItem> brandItems;
String []brand;
@Begin(join=true)
public void ProductsList()
{
brandItems=new LinkedList<SelectItem>();
prodlis= entityManager.createQuery("select b from TblProducts b where b.subcategoryId="+hid).getResultList();
temp=new ArrayList<TblProducts>(prodlis);
List<String> filter= entityManager.createQuery("select distinct(t.brand) from TblProducts t where t.subcategoryId="+hid).getResultList();
for(String a:filter)
brandItems.add(new SelectItem(a,a));
}
public String[] getBrand() {
return brand;
}
public void setBrand(String[] brand) {
this.brand = brand;
List<TblProducts> temp1=new ArrayList<TblProducts>();
for(String a:brand)
for(TblProducts b:temp)
if(b.getBrand().equalsIgnoreCase(a))
temp1.add(b);
if(brand.length>0)
prodlis=temp1;
else
prodlis=temp;
}
@End
public void reset() {
// TODO Auto-generated method stub
}
@Destroy
@Remove
public void destroy() {
// TODO Auto-generated method stub
}
}
this code for data table filter ,
if any one click the particular brand i need to filter the data table records with the brands.
i have the problem with IE back button .
after filter particular brand , then i visit some other page , then i hit back button of the browser , i check box selection will be deselected , and also my data table shows all the products .
i need to maintain the previous filter stage .
How to do that.
By
Thiagu.m