|
|
This post has NOT been accepted by the mailing list yet.
I have two domain class:
class Property {
String propertyNo
String propertyTitle
String propertyDescription
Date modifyDate
String propertyType
String street
String city
String state
boolean isSold
String postalCode
boolean isPriceNegotiable
PropertyPrice propertyPrice = new PropertyPrice()
static embedded = ['propertyPrice']
static constraints = {
propertyNo()
propertyType()
propertyTitle()
propertyDescription()
street()
city()
state()
postalCode()
modifyDate(display:false)
isSold(display:false)
}
def beforeInsert = {
modifyDate = new Date()
}
def beforeUpdate = {
modifyDate = new Date()
}
def String toString(){
return propertyNo
}
}
and the other one is
class PropertyPrice {
String priceType
String priceValue
static constraints = {
priceType(inList:["SOLD","RENT","BOND"])
}
}
When I create property, it always throw NullPointException.
Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <g:render>: Error evaluating expression [propertyPriceInstance.constraints.price
Type.inList] on line [83]: Cannot get property 'constraints' on null object
->> 36 | doCall in D:/workspace/ssproperty/grails-app/views/property/create.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:render>: Error evaluating expression [propertyPriceInstance.constraints.priceType.inList] on line [83]: Can
not get property 'constraints' on null object
->> 31 | doCall in D:/workspace/ssproperty/grails-app/views/property/create.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GroovyPagesException: Error evaluating expression [propertyPriceInstance.constraints.priceType.inList] on line [83]: Cannot get property 'constraints'
on null object
->> 83 | run in D:/workspace/ssproperty/grails-app/views/property/_form.gsp
Could you tell me what's wrong with my code? My grails version is 2.0.3
Thanks!
|