File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes create HTML forms frm DataBase fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "create HTML forms frm DataBase fields" Watch "create HTML forms frm DataBase fields" New topic

create HTML forms frm DataBase fields

Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

Hey.....I want to create HTML forms in JSP, and the forms information get from DataBase for examples form fields name ,fields titles and fields type are come from dataBase,,,,,,How can i mange it Because i not know which type of data come from database means its a text or dropdownlist or radio buttons or textarea?

please any body help me..................
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
You should know what type of data in database.
Actually how can we save dropdown in database.
We can save any values (text) in DB column You should know that column will be for dropdown or text accordingly you can code JSP.

If you know that then You can use POJO for this in that feilds on JSP as variable & with getter setter according to Javabean spec. then by using JSP standard action & JSTL you can display that.

before going to JSP you have to get details from DB create object of your POJO set all DB values in your POJO & then set that POJO in to proper scope(request,session,application).

Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

actually i have multiples form that first save in DB then i get all details from DB, But problems is that how can i mange it on jsp pages........I mean i dont know the first fields are text types and seconds is radio buttons or textarea.........

Because i have many forms that i want to create from DB informations..............
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
While saving to DB there should be one Column in DB table for each feild.
Then how your problem is coming?
That means You should know which column in DB is textBox in JSP & which One in Dropdown.
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

i have this informations that i get from DB

19111textAdd Title
22111radioProperty Type
23111dateDate availabale
25111textLocal area
26111textYouTube video URL
27111textCreate a password for your ad
28111textRetype your password
30111emailEmail Address
31111numberPhone Number
32111emailReceive responses to your ad by
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Posts: 60

Now sir You see cat_id is 111 i create one html form against this id. same as many ids and many forms i want to create.

The logice that i create here is this.....

<div class="fields">
<input tabindex="1" class="required text long character-count" maxlength="100" name="title" id="title" value="">

but i think my approch is not correct.

i think you know complete..
please now tell me any solutions..
I agree. Here's the link:
subject: create HTML forms frm DataBase fields
Similar Threads
submit two forms from one html files
databound api
Huge JSF Froms
using one bean across several forms
Dynamic form