0

URL でパラメーターを渡そうとしていますが、Managed Bean の「クラスをインスタンス化できません:」というエラーが発生します。コードはこちら:

URL を作成:

  <h:outputLink id="link"
     value="#{facesContext.externalContext.requestContextPath}/Public/Home/altKanallar.jsf?id=#{item.id}&name=#{item.name}">
     <h:outputText value="#{item.name}" />
  </h:outputLink>

altKanallar.jsf

    <h:form>
        <div style="text-align: center;">

        <div style="text-align: left;">
        <h:panelGrid style="font-size: 12px; text-decoration:none; " width="100%">
            <h:dataTable value="#{altKanallarBean.categories}" var="item"  style=" width : 100%;">
                <h:column>
                    <h:outputLink id="link"
                        value="#{facesContext.externalContext.requestContextPath}/Public/Home/default.jsf">
                        <h:outputText value="#{item.name}" />
                    </h:outputLink>

                    <div style="style=clear:both; font-size:1px; height:2px; line-height:1px;">
                    </div>
                    <div style="border-bottom:1px solid #D3E8FF; font-size:1px; height:1px; line-height:1px;">
                    </div>
                    <div style="style=clear:both; font-size:1px; height:2px; line-height:1px;">
                    </div>
                </h:column>

            </h:dataTable>
        </h:panelGrid>
        </div>
    </h:form>

AltKanallarBean.java

public class AltKanallarBean {


    private   List<com.uzmantv.data.category.Item> categories;  

    public AltKanallarBean(){
        HttpServletRequest request=(HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
        System.out.println(request.getParameter("name"));
        System.out.println(request.getParameter("id"));
        categories = RestServices.getCategoriesById(Long.parseLong(request.getParameter("id"))).getItems();
        name = request.getParameter("name");
    }



    public List<com.uzmantv.data.category.Item> getCategories() {
        return categories;
    }



    public void setCategories(List<com.uzmantv.data.category.Item> categories) {
        this.categories = categories;
    }
}
4

2 に答える 2

0

コンストラクター AltKanallarBean() が例外をスローしないことを確認してください。一般に、これはコンストラクターでビジネス ロジックを呼び出すことはお勧めしません。

于 2010-09-29T12:41:17.170 に答える
0

ご協力ありがとうございました。問題は解決しました。

AltKanallarBeanJboss はクラスをデプロイしませんでした。Eclipse を閉じて再度開き、jboss をクリーンアップするのに何時間もかかりました。

于 2010-09-29T13:16:45.073 に答える