While using Spring’s SimpleFormController, I got a new form every time I had a validation error.
It was driving me crazy until I used ‘post’ as the form method instead of ‘get’. I had temporarily changed to “get” to see if all values were transmitted.
This is documented in the Javadocs and probably somewhere in the documentation, so this was my fault. Still, it looks strange to me.
Archive for June, 2004
Tuesday, June 29th, 2004
Friday, June 18th, 2004
A Lucene (1.4-rc3) exception that has bothered me for a long time now:
class java.lang.NullPointerException: null
org.apache.lucene.store.FSDirectory.create(FSDirectory.java:146)
org.apache.lucene.store.FSDirectory.(FSDirectory.java:126)
org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:102)
org.apache.lucene.index.IndexWriter.(IndexWriter.java:193)
…
Tomcat 5 solution
—————–
The solution was to edit tomcat/bin/catalina.bat and change the line which sets the
temp dir. If you don’t set it to an absolute path, Tomcat resolves filenames as relative
file names which then results in a directory without files and hence the NullPointerException.
catalina.bat:
#set CATALINA_TMPDIR=%CATALINA_BASE%\temp
set CATALINA_TMPDIR=D:\Java\Libraries\jakarta-tomcat-5.0.24\temp
Tomcat 4 solution
—————–
I don’t have access to catalina.bat on my web server, so I added this bean which sets the System property for the temp dir in my Spring configuration.
<!-- Set the Java temp dir property because of a bug in Tomcat which resolves Files as relative to the temp dir. -->
<bean lazy-init="false" id="tempDirSystemProperty"
class="org.springframework.beans.factory.
config.MethodInvokingFactoryBean">
<property name="targetClass">
<value>java.lang.System</value>
</property>
<property name="targetMethod">
<value>setProperty</value>
</property>
<property name="arguments">
<list>
<value>java.io.tmpdir</value>
<value>${temp.dir}</value>
</list>
</property>
</bean>
Friday, June 4th, 2004
Eclipse 3.0 milestone build 9 is out.
My plugins:
- colorer: syntax colorer (html, xml, javascript, …)
- xmlbuddy: xml validation/completion
- spring plugin
- lomboz: jsp syntax coloring, source completion, jsp validation
You can also use the update feature of eclipse.
Help > Updates > Find and install > Search for new features
and then “add update site”. Example:
- http://colorer.sf.net/
- http://springframework.sourceforge.net/spring-ide/eclipse/updatesite/
Useful keys (some I chose myself)
ctrl-d: delete line
shift-enter: insert next line
ctrl-shift-enter: insert previous line
ctrl-k: next word that was selected
ctrl-1: quick fix (rename variable, surround try-catch, …)
ctrl-.: next error
ctrl-shift-o: organize imports
alt-arrowleft: previous edited file
ctrl-f6: choose source file
ctrl-f7: choose editor window
ctrl-j: insert javadoc
f1: javadoc
f2: expand inline javadoc
f3: source
ctrl-space: source completion
ctrl-shift-space: show variables
ctrl-y: redo
ctrl-f4: close file
ctrl-shift-f4: close all files
“while”+ctrl+space: generate while statement
Also: window > preferences > java > editor >code assist: check “fill argument names” and “guess argument names”.
And window > preferences > xmlbuddy > uncheck “keep outline up-to-date” (crashes sometimes)