Impossibile creare un componente di cucitura, l'ambito di pagina non è attivo; SelectBooleanCheckbox

StackOverflow https://stackoverflow.com/questions/19854475

  •  29-07-2022
  •  | 
  •  

Domanda

SEAM 2.2.2, JSF 1.2. Sembra così semplice: a dataTable Dove ogni riga ha una casella di controllo che voglio osservare quando viene chiamato un pulsante. Ho un controller:

@Name("MyController")
@Scope(ScopeType.PAGE)
public class MyController {
    private List<MyItem> myItems;

    public MyItem[] getItemsList(boolean excluded) {
            return myItems;
    }

io ho il MyItem genere:

public class MyItem {
    private boolean selected = false;

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        System.out.println("setting to " + selected);
        this.selected = selected;
    }

    ... other things ...
}

Questo è il mio xhtml:

<a:form id="formExcludedList">
    <rich:dataTable id="excludeList"
        value="#{MyController.getItemsList(true)}" var="o">
        <rich:column>
            <h:selectBooleanCheckbox id="selectComponent"
                value="#{o.selected}" />
        </rich:column>

Quando si fa clic sulla casella di controllo MyItem.setSelected non viene eseguito. Tuttavia, sto ottenendo un logging funky: (curato per brevità)

DEBUG createHotDeployment - Using Java hot deploy
DEBUG beginRequest - >>> Begin JSF request for <my page>
DEBUG begin - beginning transaction prior to phase: RESTORE_VIEW(1)
DEBUG begin - beginning JTA transaction
WARN  getInstance - Cannot create Seam component, scope is not active: MyController(PAGE)
WARN  getInstance - Cannot create Seam component, scope is not active: MyController(PAGE)
WARN  getInstance - Cannot create Seam component, scope is not active: MyController(PAGE)
WARN  getInstance - Cannot create Seam component, scope is not active: MyController(PAGE)
DEBUG restoreAndLockConversation - No stored conversation
DEBUG commitOrRollback - committing transaction after phase: INVOKE_APPLICATION(5)
DEBUG commit - committing JTA transaction
DEBUG begin - beginning transaction prior to phase: RENDER_RESPONSE(6)
DEBUG begin - beginning JTA transaction
DEBUG commitOrRollback - committing transaction after phase: RENDER_RESPONSE(6)
DEBUG commit - committing JTA transaction
DEBUG endRequest - Discarding conversation state: 7
DEBUG endRequest - After render response, destroying contexts
DEBUG flushAndDestroyContexts - ... et cetera
DEBUG destroy - destroying: ...
DEBUG destroy - destroying: ... et cetera
DEBUG endRequest - <<< End JSF request for <my page>

Il tuo aiuto è molto apprezzato!

È stato utile?

Soluzione

Si è scoperto che mi mancavano alcune dipendenze JSF: jsf-api.jar e jsf-impl.jar. Successivamente ha preso quelli forniti dal mio contenitore (Websphere), che erano della versione sbagliata, quindi non funziona. Una volta applicato questi barattoli di dipendenza e della versione giusta, tutto era buono!

Altri suggerimenti

Jboss può anche lanciare questo errore se non riesce a trovare seam.properties Nella tua applicazione src/conf directory. Il file può essere vuoto, ma deve essere lì affinché l'ambito sia attivo.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top