2012-12-14 2 views
1

WEB-INF/lib 디렉토리에 primefaces-3.4RC1.jar을 포함 시켰습니다. 내가 대화 상자를 열 수있는 링크를 클릭하면 내보기PrimeFaces 3.4 RC1, 대화 상자에서 Managed Bean 속성을 인식하지 못합니다.

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<ui:composition xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:p="http://primefaces.org/ui"> 
    <div class="contentBox cornerBorder border"> 

    <p:dialog> 
    <table class="DialogTable">              
    <tr> 
    <td><label>Country</label></td> 
     <h:selectOneMenu required="true" id="contry" styleClass="text-box" value="#{myController.loc.countryId}"> 
    ----------------------------------------------------------------------------------------------^here it gives warning and if i run it crashes 

    </tr> 
    </table> 
    </p:dialog> 

과 같은

public class Location{  
    private Integer countryId; 
    //getters setters 
} 

처럼

@ManagedBean 
@RequestScoped 
public class MyController{ 

@Autowired 
Location loc; 

//other stuff 

} 

Location 클래스의 모양처럼 내 컨트롤러 메신저에서 내 모델 빈을 autowiring에 그 속성 countryId을 찾을 수 없다는 오류가 발생합니다. 내가 그것을 확인 실행 value="myController.loc.countryId"을 ... 제거하면 사람이 올바른 방향으로

PS 나를 안내 : 나는 응용 프로그램의 context.xml에서 적절한 항목을 만들었습니다


실제 오류

SEVERE : javax.el.PropertyNotFoundException : 클래스 'com.deltasoft.controller.myCo : /WebPages/personal/personalDiv.xhtml 230,119 값 = "# {myController.loc.countryId}"@ ntroller '속성에' '이 없습니다.

+0

는, 당신은을 필요해야 getter for loc –

+0

@AkselWillgert 질문을 편집하여 자세한 내용을 추가했습니다. 이미 관리 빈에 컨트롤러에 주석을 달고 범위를 정의했습니다. – dakait

+0

하지만 get이 있습니다. 테? 또한 오타라고 생각합니다 : countryID 대 countryId? –

답변

1

이와 같이 코드를 변경하고자 할 수 있습니다.

@ManagedBean 
@RequestScoped 
public class MyController{ 

@ManagedProperty 
private Location loc; // Getters and Setters. 

//other stuff 

} 

@component 
public class Location{  
    private Integer countryId; 
    //getters setters 
} 

하고 spring.xml에 당신은 당신이 @ManagedBean 일부 범위와 주석 MyController에 필요 것이라고 생각

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:security="http://www.springframework.org/schema/security" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

<context:component-scan="path to Location class path"/> 
</beans> 
+0

나는 관리 형 소품의 게터와 세터를 정의해야합니까? – dakait

+0

예. 그것은 단지'@ Autowired'와 같지만'Autowired'는 스프링 빈을 다른 정의 된 빈에 삽입하는 것입니다. 그리고 ManagedProperty는 Spring 또는 JSF 생성 된 Bean을 JSF의 @ManagedBean에 삽입하는 것입니다. – SRy

+0

문제를 해결 한 tnx 남자 ... – dakait

관련 문제