zondag 22 april 2007

icefaces 163

Just downloaded the 163 release from icesoft appeared they have fixed the bug I blogged about before. I tried to use it in my project but it doesnot start yet.
First I had to copy over 2 jars: Class not found: FileUploadBase$FileSizeLimitExceededException (commons fileupload), and facelets-icefaces not that exciting, jboss starts and ear deploys but I dont see my datatable now. Query gets excecuted. But no field generation, nada nothing.
First I'm going to see whether its possible to switch to jsf1.2 (Apparant changing the myfaces impl jars to the jsf ref ones).

dinsdag 17 april 2007

implementing many2many

I'm currently trying to implement a many2many relationship. Using jsf's selectMany thingy. Apparantly jboss seam does have something similar integrated in seam, now I've to use selectitems, converters and what's more. I tried the seam implementation a while ago, but I couldnt get it to work it also had a beta in the name, which is discouraging.

As the myfaces/icefaces combination also has shown some weird behavior I decided to download both and add them as projects in eclipse, so I can do some debugging, and add logging. A feature with both products seriously lack.
Myfaces is build with maven :
D:\projects\seamice\myfaces\core> d:\programs\maven-2.0.4\bin\mvn 
produces the api and impl files, which can be copied:
 copy /Y  impl\target\myfaces-impl-1.1.6-SNAPSHOT.jar d:\programs\jboss-4.0.5.GA\server\default\deploy\jbossweb-tomcat55.sar\jsf-libs\myfaces-impl.jar 

(and repeat cmd above for the api jars, donot copy the source jars).

The first obstacle I encountered was the output.
I did do something like:
SelectItem item = new SelectItem();
But the output in the html both value and label as the label.

codesnippet MenuRenderer:

if (logger.isTraceEnabled()) {
logger.trace(LogUtil.getLogMsg(methodName, LogUtil.VERSION
,"start to render option for '" + uiComponent.getId() + "' and item label '" + selectItem.getLabel() + "' and itemvalue '" + selectItem.getValue() + "'"));
DOMContext domContext =
DOMContext.attachDOMContext(facesContext, uiComponent);

Element select = (Element) domContext.getRootNode();
Element option = domContext.createElement("option");

if (optionGroup == null) {
} else {

String valueString = formatComponentValue(facesContext, uiComponent,
if (logger.isDebugEnabled()) {
logger.debug(LogUtil.getLogMsg(methodName, LogUtil.VERSION
, "created option gets value assigned of '" + valueString + "'"));

And the logging output:

15:16:05,593 TRACE [com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer] renderOption[0.1]:start to render option for '_id61' and item label 'Spuyt' and itemvalue '1'
15:16:05,656 TRACE [javax.faces.component.UISelectMany] getValueBinding[0.1]:start with 'converter'
15:16:05,671 INFO [nl.jeroen.testdb.persist.SubjectMgrBean] getting as string for '1' class java.lang.Integer'
15:16:05,671 INFO [nl.jeroen.testdb.persist.SubjectMgrBean] getting as string for '1' class java.lang.Integer'
15:16:05,671 DEBUG [nl.jeroen.testdb.persist.SubjectMgrBean] [getRoleValues: ]0.1: starting ''
15:16:05,687 DEBUG [com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer] renderOption[0.1]:created option gets value assigned of 'Spuyt'
In between something is going wrong and apparantly its the converter.getAsString method is being called, and this nicely retrieves the role with the passed argument as id, and returns the name.
But this is exactly why I switched back to Integers instead of the Roles because the conversion back (getAsObject) is not working as expected.
Because after submitting the form, I'd expect the getAsObject method to be called before the HTMLSelectManyListbox(UISelectMany).validateValue() (part of myfaces) but that's not happening.
validateValue's signature is:

validateValue(FacesContext context, Object convertedValues)

but my own logging states:

validateValue[0.1]:validate Value '[2, 6]'

convertedValues would expect that the values have been converter.getAsObject(..) but alas..
iceface's blocking servlet is doing in rendercycle, lifecycle.execute();

UISelectMany does contain a getConvertedValue method which delegates the conversion of the submitted values to a renderer (MenuRender in our case). This menurenderer is not calling the converter.getAsObject so there's the error!

Why is eclipse code formatter putting all the operands on the end of the line? I would prefer it to put at the start of the line, in case of long lines you don't have to scroll right. (I use the term operands here for characters like + . , etc)

Icefaces seam and all

Hopefully an effort which will last to monitor my progress on my journey into jboss seam, icefaces and other relevant technologies. In the far past I used to be the treasurer of my volleybalclub, and I made a nice webapplication for maintaining all my expenses, credits debets etc. This application was made in Silverstream my employer at that time, but Silverstream went out of business or novell took over or god knows what and I havent been able to maintain the application or even migrate the application.
Of course my suceessor used Excel again and nothing wrong with Excel but I still have the feeling that there might be some business in a small treasure like application for small / medium sized clubs or institutes. I'm not really hindred by a bookkeeping or economic background, so that is not an obstacle.
Since 4 or 5 years I've been carrying the idea of reimplementing the application using the various opensource java techniques available at time. EJB 1.1, 2, struts, jsp, jsf, tapestry jsf etc. All without much result, I just haven't been able to master the technologies without proper guidance or education in my own spare time. Looking at the ejb3 comments its probably not really a shame, but It felt like it and finally I dare to speak out openly.
Lately I discovered seam and jboss and I have the feeling that this combination with jsf (icefaces) may work out. Hopefully I'm capable of keeping this blog up to date so people may benifit from it and otherwise it might be a worthwile resource for me to look back.