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

Dynamic Forms

Jason McCerly
Greenhorn

Joined: Apr 24, 2005
Posts: 1
I'm trying to create a dynamic form using JSP, servlet, etc. When I say dynamic, for example I have 15 different forms with different questions that will display depending on which type a questions is selected on the page before the form page.

What I'm trying to do is have one jsp for these 10 forms instead of creating 10 pages with different form content. I have all the questions in my database and can display one set of questions on a jsp but trying to figure out how to display the text area, text field, list/menu box next to the questions that need one of these form entries.

I started out trying to use a java string buffer but haven't been successful. Can somebody give me some answers on how to construct this project? I've searched on the web for an example but no luck. If you know of a tutorial or a book that gives step by step instructions please let me know. Thank You.

-

-
Filip Pas
Greenhorn

Joined: Apr 22, 2005
Posts: 12
You could look into using sitemesh.
It allows you to combine different pages easily.
Neeraj Dheer
Ranch Hand

Joined: Mar 30, 2005
Posts: 225
Hi!

One way i can think of is:

1. make one page per question(yes, something you were trying to avoid, but let me finish).
2. In the database/configuration file, map the questions to the file names.
3. make only one JSP and use the <@include file = "result fromDB/configuration file"/> jsp directive to include the contents of the appropriate file.

The advantages, that i see, of doing this are:

1. You still have only on JSP.
2. The question-file name mapping goes in the DB/config file and so if you want to change the name of the file, you can do so without havingto change anything in the JSP.
3. Changing the format/content of the individual files becomes easy and does not affect the rest of the code.
4. The generic formatting/page headers/logos etc still remain in the JSP and are automatically applied to the individual files. Also, if you want to change the general look and feel of your application, you only have to change it in one place.

I hope you find this useful.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic Forms