-
1. Re: how to put lists in the session or application scope
bking007 May 20, 2010 7:28 PM (in response to bking007)Got it:
@Out(scope=ScopeType.SESSION, required=false) List<SelectItem> list1; @Factory(value="list1") public void getList1() { list1 = return em.createQuery(queryStr).getResultList(); } <h:selectOneMenu value="#{val1}"> <f:selectItem itemLabel="-- Select --" itemValue="#{null}"/> <f:selectItems value="#{list1}"/> </h:selectOneMenu>
-
2. Re: how to put lists in the session or application scope
rohit1183 May 1, 2012 4:25 PM (in response to bking007)I am facing an issue with any scope greater than EVENT.
I had this
@Factory(value="allDistinctDwellTypes", scope=ScopeType.EVENT)
public List<DwellType> getDistinctDwellTypes(){
//code to get the list
}
On my UI I had this:
<h:selectOneListbox id="dwellType" size="1" value="#{allDevelopmentsAction.developmentSearch.dwellType}" required="false">
<s:selectItems value="#{allDistinctDwellTypes}"
label="#{dwellType.description}" var="dwellType" noSelectionLabel="Choose" />
<s:convertEntity />
</h:selectOneListbox>
With EVENT scope every thing works fine. However if I change the scope to say APPLICATION, then the list box is populated fine with the options but as and when I choose an option and submit the page, I get an error saying value is required. This does not occur with EVENT scope.
I have also tried your suggestion by using @Factory method which returns void and then using @out and setting the scope of the variable as APPLICATION. But same thing happens.