لا يمكن إنشاء مكون التماس ، نطاق الصفحة غير نشط ؛ SelectBooleAncheckbox

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

  •  29-07-2022
  •  | 
  •  

سؤال

التماس 2.2.2 ، JSF 1.2. يبدو بسيطًا جدًا: أ dataTable حيث يحتوي كل صف على خانة اختيار أريد ملاحظتها عندما يتم استدعاء بعض الزر. لدي وحدة تحكم:

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

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

لدي MyItem يكتب:

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 ...
}

هذا هو 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>

عند النقر فوق خانة الاختيار MyItem.setSelected لم ينفذ. أحصل على بعض التسجيل غير التقليدي: (تم إعداده للإيجاز)

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>

مساعدتك موضع تقدير كبير!

هل كانت مفيدة؟

المحلول

اتضح أنني كنت أفتقد بعض تبعيات JSF: jsf-api.jar و jsf-impl.jar. بعد ذلك ، استغرق الأمر تلك التي توفرها الحاوية الخاصة بي (WebSphere) ، والتي كانت من النسخة الخاطئة ، وبالتالي لا تعمل. بمجرد تطبيق الجرار التبعية هذه والنسخة الصحيحة ، كان كل شيء جيدًا!

نصائح أخرى

قد يرمي JBoss هذا الخطأ أيضًا إذا لم يتمكن من العثور عليه seam.properties في طلبك src/conf الدليل. قد يكون الملف فارغًا ، لكنه يجب أن يكون هناك حتى يكون النطاق نشطًا.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top