0

Show table PostgreSQL

asked 2011-05-05 11:24:40 +0800

kikeskate gravatar image kikeskate
261 2

Wich is the stament to show the data of my DB in my .ZUL page


<?page title="Previous Executed Jobs" contentType="text/html;charset=UTF-8"?>
<zk>
<style>
    body {  
           background-image: url('images/fondos.jpg'); 
           
          }		
</style>

<window>
	
	<include src="vprincipal.zul"/> 
	 
</window>

<window title="Previus Jobs Executed" border = "normal">

<grid mold="paging" pageSize="10" >
		<columns>
			<column label="Execution ID"/>
			<column label="Start Date"/>
			<column label="End Date"/>
			<column label="Start Hour"/>
			<column label="End Hour"/>
			<column label="Ingest Rawdata" width="100px"/>
			<column label="Export Presence" width="120px"/>
			<column label="Export Flows" width="100px"/>
			<column	label= "Rasterizat" width="100px"/>		
		</columns>
		<rows>	
		
			<zscript><![CDATA[
            import org.zkoss.zul.*;
            int[] orderArray = new int[26];
            for (int j=0; j<26; j++){
                orderArray = 390 + j;
            }
        ]]></zscript>
		
			<row forEach="${orderArray}">
				
				<label value="submit()" id="id"/>
				<label value="submit()" id="s_date"/>
				<label value="submit()" id="e_date"/>
				<label value="submit()" id="s_hour"/>
				<label value="submit()" id="e_hour"/>
				<label value="submit()" id="in_raw"/>
				<label value="submit()" id="ex_presen"/>
				<label value="submit()" id="ex_flow"/>
				<label value="submit()" id="raste"/>				
			</row>
			
			<row>
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
			</row>
		
			<row>
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
			</row>
			
			<row>
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
			</row>
			
			<row>
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
			</row>
			
			<row>
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
			</row>
			
			<row>
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
			</row>
			

			
			<row>
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
				<label value="" />
			</row>
			
			
		
		
		</rows>
	</grid>
	
	
	
	
	<div  align="center"> 
		<button label=" Process " onClick="" width="90px"/>
	</div>

</window>
	
	 <zscript><![CDATA[
	                   
     import java.sql.*;
     
     void submit() {
         //load driver and get a database connetion
         Class.forName("com.mysql.jdbc.Driver");
         Connection conn = DriverManager.getConnection(
             "jdbc:mysql://localhost/test?user=postgres&password=nino1n");
         PreparedStatement stmt = null;
         try {
             stmt = conn.prepareStatement("INSERT INTO user values(?, ?)");
  
             //insert what end user entered into database table
             stmt.setString(1, id.value);
             stmt.setString(2, s_date.value);
             stmt.setString(3, e_date.value);
             stmt.setString(4, s_hour.value);
             stmt.setString(5, e_hour.value);
             stmt.setString(6, in_raw.value);
             stmt.setString(7, ex_presen.value);
             stmt.setString(8, ex_flow.value);
             stmt.setString(9, raste.value);
  
             //execute the statement
             stmt.executeUpdate();
         } finally { //cleanup
             if (stmt != null) {
                 try {
                     stmt.close();
                 } catch (SQLException ex) {
                     log.error(ex); //log and ignore
                 }
             }
             if (conn != null) {
                 try {
                     conn.close();
                 } catch (SQLException ex) {
                     log.error(ex); //log and ignore
                 }
             }
         }
     }
     ]]>
     </zscript>

	
</zk>


- Table: pre_

-- DROP TABLE pre_;

CREATE TABLE pre_
(
  id name,
  s_date date,
  e_date date,
  s_hour interval,
  e_hour interval,
  in_raw numeric,
  ex_presen numeric,
  ex_flow numeric,
  raste numeric
)
WITH (OIDS=FALSE);
ALTER TABLE pre_ OWNER TO postgres;


Appreciate the help

kike

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-05-05 12:09:53 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Connection conn = DriverManager.getConnection( "jdbc:mysql://localhost/test?user=postgres&password=nino1n"); ????????

link publish delete flag offensive edit

answered 2011-05-05 12:17:05 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

With the series of questions you've asked on the forum, I strongly encourage you to go to the Documentation page, scroll down and find the link on the left labeled Creating a Database-driven Application. Download the sample code, read the documentation thoroughly, and learn about the MVC paradigm. I also strongly discourage you from pursuing the course you're on of putting all of this Java code in your .zul file - "it just ain't right"...

While you're on the Documentation page, read all the articles in the Getting Started section. Yeah, sounds boring...teaches a lot, though.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-05-05 11:24:40 +0800

Seen: 345 times

Last updated: May 05 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More