<wicket:container> cannot be replaced by ajax Replace <wicket:container> with a <div> or <span> instead. Weirdly Ajax will work in development mode but refuse to work in production mode 😦 See discussion here: http://apache-wicket.1842946.n4.nabble.com/Works-in-Development-Mode-but-not-in-Production-Mode-td2300335.html http://apache-wicket.1842946.n4.nabble.com/Problem-with-RuntimeConfigurationType-DEPLOYMENT-td4655679.html https://www.google.com/?#q=Ajax+wicket+not+working+correctly+in+DEPLOYMENT+mode.
Getting Valuemap property values from inside form components
ValueMap properties = new ValueMap()public FormName(String id) { super(id); properties.put("key1", "value1")add new AjaxSubmitLink("submitLink"){@Overrideprotected void onSubmit(AjaxRequestTarget target, Form<?> form) {String value1 = ( (FormName) form ).getProperties().get("key1")}
Resolving error : Unknown type: METHOD_DEF
This is related to anonymous inner classes. Groovy now supports anonymous inner classes. So if you still get this error check the indentation of your curly braces "{"For example:I had writtenPageableListView pageableListView = new PageableListView("productsRepeating", list, 2){@Overrideprotected void populateItem(ListItem item) {INSTEAD OFPageableListView pageableListView = new PageableListView("productsRepeating", list, 2){@Overrideprotected void populateItem(ListItem item) { STACKTRACE : [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: … Continue reading Resolving error : Unknown type: METHOD_DEF
java.net.UnknownHostException: smtp.sendgrid.net
If you get this error change the grails -> mail settings Config.groovy to try other available sendgrid smtp ports : 25, 2525, 587, and 465 See: http://sendgrid.com/docs/User_Guide/smtp_ports.html Failed message 1: javax.mail.MessagingException: Unknown SMTP host: smtp.sendgrid.net; nested exception is: java.net.UnknownHostException: smtp.sendgrid.net
Steps to set up a brand new computer with Grails + Wicket
+ Install Java 1.6 already installed on most new Macbooks : Type "which java" on command-line + Install Groovy 1.7.10 http://groovy.codehaus.org/Download + Install grails 1.3.7 http://grails.org/download + Install mysql-server : the actual database to hold your data http://databases.about.com/od/shareware/ht/Installing-Mysql-On-Mac-Os-X-10-7-Lion.htm + Download mysql-client into /usr/local/mysql so you can login to mysql to create tables, run queries etc. … Continue reading Steps to set up a brand new computer with Grails + Wicket
Wicket RepeatingView shows only 1 item if there are 2 items with the same name
Interesting issueI was using "new TreeSet<Object>(getObjects())" to populate a Wicket RepeatingView with a list of items sorted by "name"For the sorting to work I also added a "compareTo()" method to the Object using the "name"Turns out when there are 2 objects with the same name, TreeSet only returns one object because TreeSet does not allow … Continue reading Wicket RepeatingView shows only 1 item if there are 2 items with the same name
groovy.lang.GroovyRuntimeException: Could not find matching constructor
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: Page$Form$1(Page$Form, org.codehaus.groovy.grails.web.json.JSONObject, java.lang.String) I use wicket with grails. In wicket nearly every component is an anonymous inner class. Turns out I got this error when I tried to use a "closure" inside an anonymous inner class. Here is the sanitized code products.each { product -> add(new Link<Void>("addProductLink"){ … Continue reading groovy.lang.GroovyRuntimeException: Could not find matching constructor
Cannot invoke method save() on null object
From Grails documentation: The save method returns null if validation failed and the instance was not persisted, or the instance itself if successful. This lets you use "Groovy truth" (null is considered false) to write code like the following: http://grails.org/doc/latest/ref/Domain%20Classes/save.html To see what the validation error is: Use: save(failOnError:true) Same goes for merge(): merge(failOnError:true) especially if you use the pattern: obj = … Continue reading Cannot invoke method save() on null object
Groovy Enum exception
Solution : Check your constructor param one by one for the correct datatype, correct number of params etcI had changed the datatype of one of the contructor params in the private variable but forgot to change the Constructor param's datatype and Groovy being runtime.. you know how that story unfolded.Thanks to : http://groovy.329449.n5.nabble.com/Could-not-find-matching-constructor-for-enum-td922940.html---Caused by: groovy.lang.GroovyRuntimeException: Could … Continue reading Groovy Enum exception
Fixing groovy.lang.MissingPropertyException during null-check on JSONObject property
ERROR:Caused by: groovy.lang.MissingPropertyException: No such property: empty for class: org.codehaus.groovy.grails.web.json.JSONObject$NullFIX:Checking for jsonObject.propertyName == null throws missing property exception above. Correct way : if(jsonObject.isNull("propertyName"))http://stackoverflow.com/questions/8802236/how-to-compare-null-value-from-the-jsonobject-in-java