Hi, I am new to Grails, Spring, and Groovy but I have years of J2EE experience. I would like one of my domain objects to do some extra logic when it is initially created and persisted. Can someone tell me how I can do this? Ideally, it will be code inside the domain object. Thanks!
Understood. I believe this will work, since I really only need it to happen before the persistence time. However, it may not work great as I'm not sure if these changes will appear to the view when the controller's create() is called.
Well, it turns out that it wouldn't work. In that method, I wanted to create another domain class which would be saved in a cascade, but it doesn't work. Calling my code to create that other object in the controller before the save works well.
As you render the PNG to the user, should'nt you use
response.contentType instead of request?
El día 24 de febrero de 2012 05:58, Qin Ding <[hidden email]> escribió:
> I installed the qrcode generator plugin. Then 1) in my grail page, I
> added <%@ page import="org.codehaus.groovy.grails.plugins.qrcode.*" %> to
> the top of the page; 2) at the body section of the page ,
> I added <qrcode:image text="hello world"/>
> I got the following error:
> | Error 2012-02-23 22:40:26,987 ["http-bio-8080"-exec-8] ERROR
> errors.GrailsExceptionResolver - IllegalArgumentException occurred when
> processing request: [GET] /eguahao/customer/show_ticket/2
> operation "Encode" requires parameter at index 0 to be non-null.. Stacktrace
> Message: operation "Encode" requires parameter at index 0 to be non-null.
> I then added to my controller:
> request.contentType = "image/png"
> def outputStream = request.outputStream
> QRCodeRenderer qrcodeRenderer = new QRCodeRenderer()
> qrcodeRenderer.renderPng("hello world", 100, outputStream)
> I got the error stating request.contentType is read only. I comment out the
> request.contentType, then I got the exact same error about the "Encode"
> requires parameter at index 0 to be non-null.
> What did I miss here? I am using grails 2.x.
To unsubscribe from this list, please visit:
As for me, I am testing the related java barcode generator these days. Do you have any ideas about it? Or any good suggestion? I am totally a green hand on barcode generating field. Any suggestion will be appreciated. Thanks in advance.