Archive for the ‘coding’ Category

Error deploying AppFuse application on Tomcat

When trying to deploy an AppFuse application on Tomcat I received the following error: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 153 in the generated java file Type mismatch: cannot convert from null to int An error occurred at line: 168 in the generated java file Cannot cast from Object [...]

Date fields in forms using Spring and AppFuse

I had some problems getting date fields to work (and return a friendly error message) so here comes a little documentation for future reference. This was in an AppFuse based Spring Framework project. The model contains a java.util.Date property and simply exposing it as usual in a form will cause an exception since Spring doesn’t [...]

Hibernate HQL like query using named parameters

Using the LIKE condition with a “%” sign for pattern matching in a HQL query with named parameters required some tweaking. This did not work: It resulted in a org.hibernate.QueryException: unexpected char: ‘%’ error. Next I tried using single quotes: Didn’t work either, an org.hibernate.QueryParameterException: could not locate named parameter. What actually worked was putting [...]

I18n workaround for Spring form:options tag

Spring Framework provides the convenient form:options tag to render a list of <option> tags for a form <select>. Here is an example: It does iteratate through statusList and will output each item as an option with the value statusList[i].id and the text statusList[i].label and automatically make the option corresponding to status selected. Unfortunately form:options does [...]

AppFuse and NetBeans: part 2

Some more tips about getting an AppFuse generated application into NetBeans. Pick archetype of choice, e.g.: mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/releases -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject Run mvn Generate full sources: mvn appfuse:full-source Install the Maven plugin in NetBeans (Tools / Plugins / Search for Maven). Open the project (located the pom.xml file) Right-click the project name [...]