2012-11-28 2 views
0

필드 플러그인을 사용하여 필드 스캐 폴딩 코드를 수정하려고합니다. 트위터 부트 스트랩도 설치했습니다. 이제 한 행에 2 개의 필드를 표시하고 싶습니다.필드 플러그인을 사용하여 grails 스캐 폴딩 템플릿을 수정할 때 예외가 발생했습니다.

private renderFieldForProperty(p, owningClass,counter, prefix = "") { 
    boolean hasHibernate = pluginManager?.hasGrailsPlugin('hibernate') 
    boolean display = true 
    boolean required = false 
    if (hasHibernate) { 
     cp = owningClass.constrainedProperties[p.name] 
     display = (cp ? cp.display : true) 
     required = (cp ? !(cp.propertyType in [boolean, Boolean]) && !cp.nullable && (cp.propertyType != String || !cp.blank) : false) 
    } 
    if (display) { 
     if(counter%2==0){ 
      %><div class="row-fluid"><% 
      } 
     %> 
     <f:field bean="${domainClass.propertyName}" property="${p.name}"/> 
<% 
counter++ 
if(counter%2==0){ 
      %></div><% 
} 
} } %> 

지금 생성 된 코드는 다음과 같다 : 나는 내 _form.gsp 템플릿 파일에 다음 한

<div class="row-fluid"> 
     <f:field bean="patient" property="familyName"/> 

     <f:field bean="patient" property="firstName"/> 
</div> 

나는이 예외있어 브라우저의 코드를 보려고 :

URI 
    /patient/create 
Class 
    org.springframework.beans.NotReadablePropertyException 
Message 
    Invalid property 'familyName' of bean class [java.lang.String]: Bean property 'familyName' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? 

제가 잘못 생각한 것 같습니까? 어떻게 해결할 수 있을까요?

감사합니다, 페라

답변

1

해당 필드 태그는 "환자"콩을 확인할 수 없습니다 보인다. 스캐 폴딩 모델에 따라 ${}에 "patient"(bean)을 넣거나 페이지에 "patient"라는 변수를 정의해야 할 수 있습니다.

관련 문제