Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create HTML forms frm DataBase fields

 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 368
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have this informations that i get from DB

idcat_idfield_typefield_title
19111textAdd Title
20111textRent
21111select(null)
22111radioProperty Type
23111dateDate availabale
24111textareaDescription
25111textLocal area
26111textYouTube video URL
27111textCreate a password for your ad
28111textRetype your password
29111simple_nameName
30111emailEmail Address
31111numberPhone Number
32111emailReceive responses to your ad by
33111checkboxPhone
 
Mark Kafe
Ranch Hand
Posts: 60
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic