tags:

views:

730

answers:

3

I need to generate HTML forms in Java. I don't know in advance what fields are needed, those will probably be delivered in XML (i have some say over this). I could use the same input file to handle the form submission.

Are there libs, techniques that deal with this problem? I can't imagine that there aren't, but i can't find a suitable solution. I looked at XForms, but it seems that there's not enough adoption from browsers.

Any ideas? Much obliged.

( Context: JSR-286 compliant portlet (using Liferay atm) )

+3  A: 

Try using XSLT to transform your XML input to your HTML output.
Check this site for an example for the XSLT part and this site for the JAVA-XSLT connection.

Dror
+2  A: 

Hello

as already said, XSLT can be used to transform your input to htmlif you got an XML input.

Otherwise, a template engine can be used. i had success with Velocity (from the open source project Jakarta).

Regards,

PATRY
+1  A: 

Hello,

XSLTForms is an XSLT-based XForms engine for browsers. Of course, it can also be used on server-side. It's an opensource project.

The corresponding "compiler" will soon be available with technical documentation. It will permit you to customize it and add your own specific behavior.

Thanks for the tip Alain, but i decided to keep input output seperated under our control (meaning independent form technologies other than xml and xsl). Main reason for this is because of the beta label.
Jeroen Dierckx