File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "create HTML forms frm DataBase fields" Watch "create HTML forms frm DataBase fields" New topic
Author

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


Thanks,
Shailesh
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

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

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..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: create HTML forms frm DataBase fields