aspose file tools*
The moose likes JSP and the fly likes Dynamic form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Dynamic form" Watch "Dynamic form" New topic

Dynamic form

Ranch Hand

Joined: May 29, 2002
Posts: 198
I have one requirement(somebody's recommendation ) that the forms in our JSP will be generated dynamically
which means if a form has three links then any information related to links
e.g. the hyperlink text,traget etc will be coming from database.
The same concept needs to be applied through the web application for all the HTML fields e.g. which input
form fields are there in each form will also be dynamic .The idea behind all this is
if they need to change look and feel of a form in terms of the fields the form is comprised of ,
putting it in database will result in no changes in the application
whereas hard coding it in the form will require change in the code.

My questions.
1. Is this idea recommended?
2. If so when should I read all these values from database ..I believe I will have to keep all the html form related stuff in
as an application type variable which will be read at app startup , but my concern is generating the form in onload function of
body will be very complicated.

Any thoughts?
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

Oracle's html db does similar stuff, I believe. A quick read through it's docs may help. Atleast you may not have to reimplement the wheel, if you have to do it. Coding would be complex though. I have used an app that works on html dbs and have not found it wanting in terms of speed if that's any concern.

Ranch Hand

Joined: May 29, 2002
Posts: 198
Thanks for ur reply.
I am going through the docs but though of asking few more questions.
Can this oracle DB integrate with any other app server other than OAS?
Can I still integrate the html forms created by HTML DB with JSP,Servlets,EJB since I have requirements like concurrency etc which will be handled by EJB and I will be using Oracle Stored Procedures also.
I think HTML DB does not substitute Java but it just replaces the web HTML generation part of it.

Stefan Evans

Joined: Jul 06, 2005
Posts: 1018
There are advantages and disadvantages to a data driven approach like this.
I've written one before (back before I'd heard of struts et al)

Version control: Having form definitions in the database means that you can lose version control. There is no tracking of who/where/what changes were made, so you can't roll back to a previous version as easily (as opposed to having files in something like CVS)

How do you tie the fields in a form to an object/bean in your model, and then tie that to the database? Is that all declarative?

If they are simple CRUD pages, then maybe - but then there are quite a few tools out there already that will do something like that.
The more complex the page, the more you can be severely constrained by the dynamic database approach.

Just some random thoughts...
Ranch Hand

Joined: May 29, 2002
Posts: 198
Thanks Stephan for your reply.
Yes ,even the fields and all their attributes like size ,field type,the assocaited form will be coming from database.
The requirement is that if some fields need to be changed(new fields added etc),the app will get the info from database ..of course it does introduces no of complications like even if I avoid programming change for a field addition ,I got to handle that new field in business tier.

What are the various tools available and your recommendation other than Oracle HTML DB which requires Oracle10.

If I do it without any tool,I feel I have two approcahes.

1. Create the form in the onload event.But the problem is how will javascript access database ton get the GUI data.
2. Let the servlet create the JSP pages..not a good practice though.

Some more random thoughts?
I agree. Here's the link:
subject: Dynamic form