SPWrapper - plugin detailType a SQL statement or select a stored procedure, start the wizard and you will get a java source to execute it and an ant build file to customize and recreate the source. Very configurable, works with Oracle, Mysql, Postgresql and Sqlserver. The core library supports also Python code generation.
[ You have to be logged in to be able to comment. ] User CommentsAWESOME!
Great work! This thing is awesome. Visual Studio 2008 has something similar that maps your procs and table as .net classes. Works pretty slick, if you don't mind spending $500 plus dolllars.
I had been digging all over for a good Java one. And to find it built into NetBeans is a huge pluse. Keep up the great work this is again awesome.
Posted by bobmn on Jan 08, 2008
AWESOME!
Great work! This thing is awesome. Visual Studio 2008 has something similar that maps your procs and table as .net classes. Works pretty slick, if you don't mind spending $500 plus dolllars.
I had been digging all over for a good Java one. And to find it built into NetBeans is a huge pluse. Keep up the great work this is again awesome.
Posted by bobmn on Jan 08, 2008
How to write JSF code to connect to sql server 2000
Hello deveplopers,
Thanks for the last response is greate, i must confess that, your answer are helping us alot. thanks. Please, how can i use JSF code of this Page1.java that's, when i click button it will submit to database. This is the table of database i want to use: CREATE TABLE UPLOAD( NAME VARCHER(20), ADDRESS VARCHAR(30), CITY VARCHAR(20), PICTURE IMAGE ) I am using ODBC to conect the database that's: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") Connection con=DriverManager.getConnection("jdbc:odbc:UploadSource", "", "") THIS IS THE CODE I CREATED IN NETBEANS VISUAL PACK /* * Page1.java * * Created on November 29, 2007, 9:30 AM * Copyright kelly */ package fileuploadexample; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; import com.sun.rave.web.ui.component.Button; import com.sun.rave.web.ui.component.Form; import com.sun.rave.web.ui.component.Head; import com.sun.rave.web.ui.component.Html; import com.sun.rave.web.ui.component.ImageComponent; import com.sun.rave.web.ui.component.Label; import com.sun.rave.web.ui.component.Link; import com.sun.rave.web.ui.component.MessageGroup; import com.sun.rave.web.ui.component.Page; import com.sun.rave.web.ui.component.StaticText; import com.sun.rave.web.ui.component.TextField; import com.sun.rave.web.ui.component.Upload; import com.sun.rave.web.ui.model.UploadedFile; import java.io.File; import javax.faces.FacesException; import javax.faces.component.html.HtmlCommandButton; import javax.servlet.ServletContext; /** * Page bean that corresponds to a similarly named JSP page. This */ public class Page1 extends AbstractPageBean { // private int __placeholder; /** * Automatically managed component initialization. WARNING: */ private void _init() throws Exception { } private Page page1 = new Page(); public Page getPage1() { return page1; } public void setPage1(Page p) { this.page1 = p; } private Html html1 = new Html(); public Html getHtml1() { return html1; } public void setHtml1(Html h) { this.html1 = h; } private Head head1 = new Head(); public Head getHead1() { return head1; } public void setHead1(Head h) { this.head1 = h; } private Link link1 = new Link(); public Link getLink1() { return link1; } public void setLink1(Link l) { this.link1 = l; } private Body body1 = new Body(); public Body getBody1() { return body1; } public void setBody1(Body b) { this.body1 = b; } private Form form1 = new Form(); public Form getForm1() { return form1; } public void setForm1(Form f) { this.form1 = f; } private Label label1 = new Label(); public Label getLabel1() { return label1; } public void setLabel1(Label l) { this.label1 = l; } private Label label2 = new Label(); public Label getLabel2() { return label2; } public void setLabel2(Label l) { this.label2 = l; } private TextField tname = new TextField(); public TextField getTname() { return tname; } public void setTname(TextField tf) { this.tname = tf; } private Label label3 = new Label(); public Label getLabel3() { return label3; } public void setLabel3(Label l) { this.label3 = l; } private TextField taddrs = new TextField(); public TextField getTaddrs() { return taddrs; } public void setTaddrs(TextField tf) { this.taddrs = tf; } private Label label4 = new Label(); public Label getLabel4() { return label4; } public void setLabel4(Label l) { this.label4 = l; } private TextField tcity = new TextField(); public TextField getTcity() { return tcity; } public void setTcity(TextField tf) { this.tcity = tf; } private Label label5 = new Label(); public Label getLabel5() { return label5; } public void setLabel5(Label l) { this.label5 = l; } private Upload fileUpload1 = new Upload(); public Upload getFileUpload1() { return fileUpload1; } public void setFileUpload1(Upload u) { this.fileUpload1 = u; } private Button uploadFileButton = new Button(); public Button getUploadFileButton() { return uploadFileButton; } public void setUploadFileButton(Button b) { this.uploadFileButton = b; } private Label label6 = new Label(); public Label getLabel6() { return label6; } public void setLabel6(Label l) { this.label6 = l; } private StaticText fileNameStaticText = new StaticText(); public StaticText getFileNameStaticText() { return fileNameStaticText; } public void setFileNameStaticText(StaticText st) { this.fileNameStaticText = st; } private Label label7 = new Label(); public Label getLabel7() { return label7; } public void setLabel7(Label l) { this.label7 = l; } private StaticText fileTypeStaticText = new StaticText(); public StaticText getFileTypeStaticText() { return fileTypeStaticText; } public void setFileTypeStaticText(StaticText st) { this.fileTypeStaticText = st; } private Label label8 = new Label(); public Label getLabel8() { return label8; } public void setLabel8(Label l) { this.label8 = l; } private StaticText fileSizeStaticText = new StaticText(); public StaticText getFileSizeStaticText() { return fileSizeStaticText; } public void setFileSizeStaticText(StaticText st) { this.fileSizeStaticText = st; } private ImageComponent image1 = new ImageComponent(); public ImageComponent getImage1() { return image1; } public void setImage1(ImageComponent ic) { this.image1 = ic; } private HtmlCommandButton button2 = new HtmlCommandButton(); public HtmlCommandButton getButton2() { return button2; } public void setButton2(HtmlCommandButton hcb) { this.button2 = hcb; } private HtmlCommandButton button3 = new HtmlCommandButton(); public HtmlCommandButton getButton3() { return button3; } public void setButton3(HtmlCommandButton hcb) { this.button3 = hcb; } private Label label9 = new Label(); public Label getLabel9() { return label9; } public void setLabel9(Label l) { this.label9 = l; } private MessageGroup messageGroup1 = new MessageGroup(); public MessageGroup getMessageGroup1() { return messageGroup1; } public void setMessageGroup1(MessageGroup mg) { this.messageGroup1 = mg; } // /** * Construct a new Page bean instance. */ public Page1() { } /** * Callback method that is called whenever a page is navigated to, * * Note that, if the current request is a postback, the property */ private String realImageFilePath; private static final String IMAGE_URL = "/resources/image-file"; public void init() { // Perform initializations inherited from our superclass super.init(); // Perform application initialization that must complete // *before* managed components are initialized // TODO - add your own initialiation code here // // Initialize automatically managed components // *Note* - this logic should NOT be modified try { _init(); } catch (Exception e) { log("Page1 Initialization Failure", e); throw e instanceof FacesException ? (FacesException) e: new FacesException(e); } // // Perform application initialization that must complete // *after* managed components are initialized // TODO - add your own initialization code here ServletContext theApplicationsServletContext = (ServletContext) this.getExternalContext().getContext(); this.realImageFilePath = theApplicationsServletContext.getRealPath(IMAGE_URL); } /** * Callback method that is called after the component tree has been */ public void preprocess() { } /** * Callback method that is called just before rendering takes place. */ public void prerender() { String uploadedFileName = (String) this.fileNameStaticText.getValue(); if ( uploadedFileName != null ) { image1.setUrl(IMAGE_URL); } } /** * Callback method that is called after rendering is completed for */ public void destroy() { } /** * Return a reference to the scoped data bean. */ protected SessionBean1 getSessionBean1() { return (SessionBean1)getBean("SessionBean1"); } /** * Return a reference to the scoped data bean. */ protected ApplicationBean1 getApplicationBean1() { return (ApplicationBean1)getBean("ApplicationBean1"); } /** * Return a reference to the scoped data bean. */ protected RequestBean1 getRequestBean1() { return (RequestBean1)getBean("RequestBean1"); } public String uploadFileButton_action() { // TODO: Process the button click action. Return value is a navigation // case name where null will return to the same page. UploadedFile uploadedFile = fileUpload1.getUploadedFile(); String uploadedFileName = uploadedFile.getOriginalName(); // Some browsers return complete path name, some don't // Make sure we only have the file name // First, try forward slash int index = uploadedFileName.lastIndexOf('/'); String justFileName; if ( index >= 0) { justFileName = uploadedFileName.substring( index + 1 ); } else { // Try backslash index = uploadedFileName.lastIndexOf('\\'); if (index >= 0) { justFileName = uploadedFileName.substring( index + 1 ); } else { // No forward or back slashes justFileName = uploadedFileName; } } this.fileNameStaticText.setValue(justFileName); Long uploadedFileSize = new Long(uploadedFile.getSize()); this.fileSizeStaticText.setValue(uploadedFileSize); String uploadedFileType = uploadedFile.getContentType(); this.fileTypeStaticText.setValue(uploadedFileType); if ( uploadedFileType.equals("image/jpeg") || uploadedFileType.equals("image/pjpeg") || uploadedFileType.equals("image/gif") || uploadedFileType.equals("image/png") || uploadedFileType.equals("image/x-png")) { try { File file = new File(this.realImageFilePath); uploadedFile.write(file); } catch (Exception ex) { error("Cannot upload file: " + justFileName); } } else { error("You must upload a JPEG, PJPEG, GIF, PNG, or X-PNG file."); new File(this.realImageFilePath).delete(); } return null; } public String button3_action() { // TODO: Process the button click action. Return value is a navigation // case name where null will return to the same page. return null; } public String button2_action() { // TODO: Process the button click action. Return value is a navigation // case name where null will return to the same page. return null; } } /* * ApplicationBean1.java * * Created on November 29, 2007, 9:30 AM * Copyright kelly */ package fileuploadexample; import com.sun.rave.web.ui.appbase.AbstractApplicationBean; import javax.faces.FacesException; /** * Application scope data bean for your application. Create properties * * An instance of this class will be created for you automatically, */ public class ApplicationBean1 extends AbstractApplicationBean { // private int __placeholder; /** * Automatically managed component initialization. WARNING: */ private void _init() throws Exception { } // /** * Construct a new application data bean instance. */ public ApplicationBean1() { } /** * This method is called when this bean is initially added to * * You may customize this method to initialize and cache application wide */ public void init() { // Perform initializations inherited from our superclass super.init(); // Perform application initialization that must complete // *before* managed components are initialized // TODO - add your own initialiation code here // // Initialize automatically managed components // *Note* - this logic should NOT be modified try { _init(); } catch (Exception e) { log("ApplicationBean1 Initialization Failure", e); throw e instanceof FacesException ? (FacesException) e: new FacesException(e); } // // Perform application initialization that must complete // *after* managed components are initialized // TODO - add your own initialization code here } /** * This method is called when this bean is removed from * * You may customize this method to clean up resources allocated */ public void destroy() { } /** * Return an appropriate character encoding based on the * * The default implementation uses the implementation from */ public String getLocaleCharacterEncoding() { return super.getLocaleCharacterEncoding(); } } /* * RequestBean1.java * * Created on November 29, 2007, 9:30 AM * Copyright kelly */ package fileuploadexample; import com.sun.rave.web.ui.appbase.AbstractRequestBean; import javax.faces.FacesException; /** * Request scope data bean for your application. Create properties * * An instance of this class will be created for you automatically, */ public class RequestBean1 extends AbstractRequestBean { // private int __placeholder; /** * Automatically managed component initialization. WARNING: */ private void _init() throws Exception { } // /** * Construct a new request data bean instance. */ public RequestBean1() { } /** * This method is called when this bean is initially added to * * You may customize this method to allocate resources that are required */ public void init() { // Perform initializations inherited from our superclass super.init(); // Perform application initialization that must complete // *before* managed components are initialized // TODO - add your own initialiation code here // // Initialize automatically managed components // *Note* - this logic should NOT be modified try { _init(); } catch (Exception e) { log("RequestBean1 Initialization Failure", e); throw e instanceof FacesException ? (FacesException) e: new FacesException(e); } // // Perform application initialization that must complete // *after* managed components are initialized // TODO - add your own initialization code here } /** * This method is called when this bean is removed from * * You may customize this method to clean up resources allocated */ public void destroy() { } /** * Return a reference to the scoped data bean. */ protected SessionBean1 getSessionBean1() { return (SessionBean1)getBean("SessionBean1"); } /** * Return a reference to the scoped data bean. */ protected ApplicationBean1 getApplicationBean1() { return (ApplicationBean1)getBean("ApplicationBean1"); } } /* * SessionBean1.java * * Created on November 29, 2007, 9:30 AM * Copyright kelly */ package fileuploadexample; import com.sun.rave.web.ui.appbase.AbstractSessionBean; import javax.faces.FacesException; /** * Session scope data bean for your application. Create properties * * An instance of this class will be created for you automatically, */ public class SessionBean1 extends AbstractSessionBean { // private int __placeholder; /** * Automatically managed component initialization. WARNING: */ private void _init() throws Exception { } // /** * Construct a new session data bean instance. */ public SessionBean1() { } /** * This method is called when this bean is initially added to * * You may customize this method to initialize and cache data values */ public void init() { // Perform initializations inherited from our superclass super.init(); // Perform application initialization that must complete // *before* managed components are initialized // TODO - add your own initialiation code here // // Initialize automatically managed components // *Note* - this logic should NOT be modified try { _init(); } catch (Exception e) { log("SessionBean1 Initialization Failure", e); throw e instanceof FacesException ? (FacesException) e: new FacesException(e); } // // Perform application initialization that must complete // *after* managed components are initialized // TODO - add your own initialization code here } /** * This method is called when the session containing it is about to be * * You may customize this method to release references to session data */ public void passivate() { } /** * This method is called when the session containing it was * * You may customize this method to reacquire references to session */ public void activate() { } /** * This method is called when this bean is removed from * * You may customize this method to clean up resources allocated */ public void destroy() { } /** * Return a reference to the scoped data bean. */ protected ApplicationBean1 getApplicationBean1() { return (ApplicationBean1)getBean("ApplicationBean1"); } } <?xml version="1.0" encoding="UTF-8"?> Thanks for your response kelly. snookcent@yahoo.com jpecula@yahoo.com
Posted by jbeans on Nov 29, 2007
|