| Author |
HOWTO create a page on runtime (JSP ?JSF? VWP?)
|
laurent A.
Greenhorn
Joined: Nov 27, 2007
Posts: 2
|
|
Hi all I don't know if I'm in the correct forum ; so please just tell me and I will move my post. I'm working on a jee5 (jpa/ejb3/jsf) application using NB6 and them VWP this is for the background. My job is to mock an older app written in a proprietary language to java Now my problem is this : How one can manage to create a "on-the run" edit page filled with components which numbers and types is function of the data present in the database. For example record "A" of aTable presents 3 strings and 2 combos to be edited then record "B" due to his type presents 8 textefields 2 combos and an image and 3 address groups of fields etc... All these little set of pages is really dynamics, ie depends of the database, and some linked tables to the main record. You can not know per advance for exemple that there will not be more than 10 textfields Well it's crazy that in this old weak language we were able to do some fake web templates and iterate through the record to construct the page exactly as we wanted it. How can I succeed this in JEE ? I think for sure that to reach that I must forget about NB's VWP it's normal ! But i'm lost, I'm trying some Googleing on this in vain, where to look for starting this ? Can one put me on the trail , give me some hints, links me to some tutorial ... Thanks [ February 06, 2008: Message edited by: laurent A. ]
|
 |
Huw Morgan
Greenhorn
Joined: Mar 07, 2006
Posts: 23
|
|
Hi, I am not certain what you are asking. If you want to generate a page with content generated from a database then this is exactly what jsp's are for. In netbeans 5.5.1 with MySQL I would: File / new project / web / web appication Add MySQL jdbc driver to classpath Paste into Web Pages index.jsp: <%@ page import="java.sql.*" %> <% Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = DriverManager.getConnection("jdbc:mysql://host/database?user=user&password=password"); Statement s = con.createStatement( ); String query = "SELECT stage_name, is_final FROM mouse_creation_pipeline_stage ORDER BY pipeline_position"; ResultSet rs = s.executeQuery(query); while(rs.next()) { out.println("<br>stage_name " + rs.getString(1) + " stage_name " + rs.getString(2)); } %> Run it and it should work. HTH, Hugh
|
 |
laurent A.
Greenhorn
Joined: Nov 27, 2007
Posts: 2
|
|
Thanks, for your help. This is Ok for me , my trouble is to know what is the recommended way to generate dynamic forms for editing / updating the records when the components you must provide is differents depending on the records fields (this a textfield, this a password, this a combo etc...) I hope my question is more clear ?
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
"laurent A. ", Please check your private messages.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: HOWTO create a page on runtime (JSP ?JSF? VWP?)
|
|
|