replay challenge
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Win a copy of JBoss AS 5 Development this week in the JBoss forum
or Spring Dynamic Modules in Action in the Spring forum!
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JSP
 
RSS feed
 
New topic
Author

create HTML forms frm DataBase fields

Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Messages: 53

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
Messages: 235

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).


SCJP 1.4.
SCWCD 1.5
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Messages: 53

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
Messages: 235

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.

SCJP 1.4.
SCWCD 1.5
Mark Kafe
Ranch Hand

Joined: Jun 23, 2008
Messages: 53

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

Joined: Jun 23, 2008
Messages: 53

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..
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JSP
 
RSS feed
 
New topic
aspose coverage