Creating dynamic data entry forms

I have a small project where I would like to generate dynamic data entry forms with a bit of logic behind them.

A simple use case would be to get a soccer uniform, so that you have a button for a bomber, and when you click on it, the user will be prompted for a player. The form will then submit a message (possibly to a web service, but possibly to a JMS queue) with the event data. eg Barcelona, ​​Target, Henry.

Then I want to create a similar shape for tennis ...

My idea was that I would create a web service where you define the business logic. (events, components, actions you do, etc.). Initially I thought I would post the sport definition from webservice to xml. Then write an application to parse the xml and dynamically create the data entry screen.

I originally thought about writing a web service and returning xml data. (which will look horrible) the rendering technology can be flexible / flash and be thin client.

Then I thought that creating forms as a java application could be done using the Swing Application Framework and that would be handy.

Then I thought, well, rather than write an xml schema to describe java forms, can I just serialize the java class and send this over the wire.

Once on this path, I am now wondering if there should only be a java framework and dynamic forms become a class that is called by reflection.

I'd love to get feedback on the above approaches and how the people on stackoverflow will solve this problem.

thanks

David.

0


a source to share


2 answers


I would avoid serialization because it is a little fragile, difficult to do safely, and difficult to diagnose.

Are you saying this is a small project, so the metadata really needs to flow from client to server? Wouldn't you rather just write the metadata (really code) as Java code?



(FWIW, my first commercial Java project dynamically created forms from a database spec (with regular additions). Before that I worked in C ++, working with an interpreter for educational systems. In both cases, I would now (and for the last decade) , wrote them as Java. Don't put people off by muttering disapprovingly about "hardcoded".)

0


a source


I would consider XForms . This allows you to define both the data model and the user interface as XML, and all you need for client side rendering is a web browser. I am assuming the event will be sent to a remote server, which makes the web browser a natural choice.

This will allow you to create a user interface on the server based on what sporting event the user wants to report, so you can easily add new forms, fix bugs, etc. without having to update the client software.



By the way, I don't understand your problems using XML. This is a viable option for your use case in my opinion.

0


a source







All Articles