| Author |
create HTML forms frm DataBase fields
|
Mark Kafe
Ranch Hand
Joined: Jun 23, 2008
Posts: 57
|
|
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: 323
|
|
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).
|
Thanks,
Shailesh
|
 |
Mark Kafe
Ranch Hand
Joined: Jun 23, 2008
Posts: 57
|
|
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: 323
|
|
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: 57
|
|
i have this informations that i get from DB
id | cat_id | field_type | field_title |
19 | 111 | text | Add Title |
20 | 111 | text | Rent |
21 | 111 | select | (null) |
22 | 111 | radio | Property Type |
23 | 111 | date | Date availabale |
24 | 111 | textarea | Description |
25 | 111 | text | Local area |
26 | 111 | text | YouTube video URL |
27 | 111 | text | Create a password for your ad |
28 | 111 | text | Retype your password |
29 | 111 | simple_name | Name |
30 | 111 | email | Email Address |
31 | 111 | number | Phone Number |
32 | 111 | email | Receive responses to your ad by |
33 | 111 | checkbox | Phone |
|
 |
Mark Kafe
Ranch Hand
Joined: Jun 23, 2008
Posts: 57
|
|
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.....
if(result.getString("FIELD_TYPE").equals("text"))
{
%>
<div class="fields">
<input tabindex="1" class="required text long character-count" maxlength="100" name="title" id="title" value="">
</div>
<%
}
%>
but i think my approch is not correct.
i think you know complete..
please now tell me any solutions..
|
 |
 |
|
|
subject: create HTML forms frm DataBase fields
|
|
|