You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mariano Petrakovsky <mp...@tecnonexo.com> on 2005/06/13 20:09:43 UTC

Bean in page Scope

I'm using some like this

					<x:aliasBean alias="#{handler}" value="#{module1Handler}">
						<f:subview id="view1">
							<jsp:include page="/component/picklist.jsp" />
						</f:subview>
					</x:aliasBean>

					<x:aliasBean alias="#{handler}" value="#{module1Handler}">
						<f:subview id="view2">
							<jsp:include page="/component/picklist.jsp" />
						</f:subview>
					</x:aliasBean>

the picklist.jsp content this:

			...
			<h:selectOneListbox id='leftList' binding="#{pickListHandler.list1}"
size="15" 							ondblclick="#{pickListHandler.addOne}" >
				<f:selectItems value="#{handler.validList}" />
			</h:selectOneListbox>
			...

from AliasBean get the SelectItems. Exists bindings with pickListHandler...
Have a pickListHandler at Page Scope. The code content:

public class PickListHandler {

    private HtmlSelectOneListbox list1;
    private HtmlSelectOneListbox list2;


    public PickListHandler() {
        list1 = new HtmlSelectOneListbox();
        list2 = new HtmlSelectOneListbox();

        list1.setId("leftList");
        list2.setId("rightList");
    }

    public String getAddOne() {

        return ("_myJs('" +
list1.getClientId(FacesContext.getCurrentInstance())+"'); return false;");

                             ^^^^^^^^^^^ (return ClientId good in Session
Scope, return _idx in Page Scope)
    }

		...
}


Good. My problem is, when I define PickListHandler to Session Scope the last
line work fine... but lost reusability because Handler is created one time.
If i'm put Page Scope to my Bean... then don't work marked line in my
code... the reallity is I don't have idea of why. Is Binding working??


--
Mariano G. Petrakovsky
Programmer · Software Factory
AXG Tecnonexo -  www.tecnonexo.com

Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
Argentina.
Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.

Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
Tel.: (202) 986-7541 - Fax: (202) 787-3891.


· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · ·