<<

jdeveloper jsf download file from server Apache MyFaces (open source JSF implementation) – Using the Tree2 Component with JDeveloper 10.1.3. In the wake of my last post – Getting started with Server Faces (JSF) using Apache MyFaces – in JDeveloper 10.1.3EA – I will continue my explorations of MyFaces in this article. In particular, I will take a look at the Tree2 Component that is shipped with Apache MyFaces. I will make use of Oracle JDeveloper 10.1.3 EA as my IDE. For details on setting up Apache MyFaces with JDeveloper 10.1.3, see the post I just mentioned. To make things easier for me – and hopefully for some of you as well – I have created a starter-project, a JDeveloper 10.1.3 Application Workspace with MyFacesBase project that contains the files you need to get started with MyFaces. You can simply download this zipfile: MyFacesBase.zip, extract it on your PC and open the JWS file in JDeveloper 10.1.3. You still need to set up the project with proper library definitions – see the previous post for details. Starting from this MyFacesBase Project we will create a beautiful tree-based JSF application. Sort of. Steps to prepare. I will first gear the base environment to my specific Tree oriented project: Extract MyFacesBase.zip to a directory; let’s refer to that directory as MyFacesTree_HOME Change the string Base to Tree in the names of the subdirectories MyFacesTree_HOME\MyFacesBase and MyFacesTree_HOME\MyFacesBase\MyFacesBase Open JDeveloper 10.1.3 Load the file MyFacesBase.jws; this will open the MyFacesBase application workspace Rename the Application to MyFacesTree. Change the name of the MyFacesBaseProject to MyFacesTreeProject. If you do not already see the project, then add it to the Application Workspace by adding the fiule MyFacesBaseProject.jpr. Go to the Project Properties of the MyFacesTree project. Verify in the Libraries tab whether the libraries MyFaces and JSTL are set up correctly and added to the project. If necessary see the post mentioned above. Also check whether the JSP Tag Libraries MyFaces-Core, MyFaces-HTML and MyFaces-ext (or Tomahawk) have been added to the project. Verifying the preparations. Now is a good time to make sure that we can indeed create and run JSF applications in the JDeveloper 10.1.3 environment and project we just set up. Follow the these simple steps: From the Right Mouse Button Menu on the MyFacesTreeProject project, go to the New Gallery. Select the node Web Tier, JSF and select the option JSF JSP. Walk through the Wizard, accepting all default choices – or making refinements as you like. The wizard create a JSP with JSF layout – importing the required Tag Libraries and layout a and a . The JSP is opened in the editor. Type a few characters – just to have some output to look at in our browser. Note: at this point we have not made any changes to faces-config. or any other configuration file. From the RMB menu on the JSP, choose the option run. The “application” should now open in the browser, displaying your trivial output. If you have gotten this far, you are in good shape to start using the MyFaces Tree component. Developing with the MyFaces Tree2 Component. Apache MyFaces is a valuable open source project providing the base implementation of the JSF standard and extending it with a large set of advanced components, called Tomahawk. The set includes TabbedPane, RssReader, Advanced Table features, inputDate and Calendar, HtmlEditor, Pulldown Menu, and many others. To confuse matters, there is a Tree, a Tree2 and a Tree Table component. It seems that Tree2 effectively replaces Tree; Tree is labeled ‘sort of obsolete’. So I focus on Tree2 for now. Using the JSP JSF wizard from the New Gallery I create a new JSP called LibraryTree.jsp. From the Component Palette, we drag and drop the Tree2 component to the JSP. The page source looks like: There are a few things worth noting here. First of all, the tree2 components has child facets; there is a facet for each type of node that the tree will contain. Apparently our tree wil contain nodes of types foo-folder, author and book. We will see later how we specify the node type on the backing bean’s model data. Each facet describes how the node type must be displayed; various node-types can make use of different icons, styles, actions etc. Note how the Node Interface provides properties like childCount, nodeExpanded and nodeSelected. The value for the tree2 component is set to: value=”# ”. That suggests that there is a Managed Bean called LibraryTreeHandler that exposes a getTreeModel method that returns an object that has a method getTreeData(). This last method must return an object that implements the TreeNode interface – in package org.apache.myfaces.custom.tree2. So there we go: create the required objects. First the LibraryHandler class: This class is a used for the managed bean called LibraryTreeHandler and referenced by the value property of the tree2 component. See the faces- config.xml file: The LibraryHandler class relies on the LibraryTreeModel class. Its code is as follows: The application looks like this in the browser. We can expand and collapse nodes. Note that all tree manipulation is done server side: each node expansion requires browser-to-server communication for updating the treenodes. The Project with the application so far can be downloaded here: MyFacesTree_Stage1.zip. Make the LibraryTree application a little more interesting. We are now going to make the application a little more interesting. We will allow Author nodes to be selected and we will display the Biography of the currently selected author – marked in the tree with an asterisk – next to the tree. It is remarkable how simple it is to add these changes to the application. If we select an Author node in the tree, the tree is redrawn and an asterisk is placed in front of that node – in the screenshot the selected node is for Orson Scott Card. At the same time, when the page is refreshed, the Results of the currently selected author are updated with the biography for the currently selected author. The changes I had to make to realize this functionality are in three location: 1. First the JSP LibraryTree.jsp. I have added the asterisk for the currently selected Author node: You can see how simple it is: the asterisk is only rendered if the current node in the tree is selected. To make the author node selectable, we add a commandLink: When the node is clicked on, the processAction method in the LibraryTreeHandler bean is invoked; this method needs to have a return type of void and accept a single ActionEvent input parameter. The next change is displaying the biography for the current author: I used a panelGroup for the rendered property: the entire panelGroup is only displayed if there is indeed a Biography available. Note that the bio is read from the authorBio property in the LibraryTreeHandler bean that is managed based on the LibraryHandler class. We will see that class in a moment. I finally made use of a panelGrid to display the tree and the bio next to each other. A panelGrid element in HTML is typically rendered as table. Okay, it is not pretty but it will do the trick. 2. The LibraryHandler class. This class now suddenly needs to provide an authorBio property and it has to absorb the processAction event. You can see that we make use of a new class, the ExtendedTreeNode. So we also need to create that class: 3. The new ExtendedTreeNode class. In order to have the new biography property for our Authors, we introduce this class: In class LibraryTreeModel we use this class to populate the nodes of our tree. The nodes we create for Authors are of the new ExtendedTreeNode type that include the biography. So we modify the LibraryTreeModel.java to: This is all it takes to create a dynamic tree, driven from a backend data model, including the select node action that updates the current biography. In a next article I will actually use the EJB 3.0 Persistence functionality out of container (the GlassFish implementation) for providing the backend data model. I will try to make the nodes updateable as well. File save dialog in jsf [duplicate] I am trying to export the result set of the DB in a excel format. And I am developing a using JSF. So what i need is that when the user clicks on the EXPORT button in my page , then a file save dialog has to open for the user to choose the directory path and the name for the file. And when the save is clicked in the file dialog then i need to write the whole result set to the excel sheet with the mentioned name and path as per users input. But i couldnt find the file save dialog and how to use the same with JSF. And I am using for the development . hassan4abdalla. This Site Sharing The knowledge That I Have And What I Found On Community. Recent Posts. أھﻢ ١٠ اﺧﺘﺮاﻋﺎت ﻣﻦ Minimum System Requirements To Run Windows 10 How to Activate Super Administrator Account in Windows 7/8/8.1/10 .ﺻﻨﻊ اﻟﻤﺴﻠﻤﯿﻦ ﺗﺼﻤﯿﻢ ﺗﻄﺒﯿﻘﺎت أﻧﺪروﯾﺪ ﺑﺪون ﻟﻐﺔ ﺑﺮﻣﺠﺔ ﷴ ﻣﻨﺪور اﻟﻤﮭﺪي Recent Comments. hassan4abdalla on Java IDEs – NetBeans vs Eclips… hassan4abdalla on Java IDEs – NetBeans vs Eclips… Thiyagu on Java IDEs – NetBeans vs Eclips… Sven on Java IDEs – NetBeans vs Eclips… Archives. Categories. Java IDEs – NetBeans vs vs JDeveloper. I have been a NetBeans and JDeveloper user for many years. I have used Eclipse on and off but can’t say that I have ever adopted Eclipse as such. Recently downloaded the new NetBeans 6.1 beta and was impressed. I already had the latest JDeveloper and Eclipse on my machine. So thought why not put down a comparison of NetBeans 6.1 Beta, JDeveloper 11g Technology Preview 3, Eclipse IDE For Java EE (Europa Winter Maintenance Package). Following is a log of my observations. I do not claim to have done a thorough comparison or to have looked at each and every feature. I have just written the differences that I noted during my routine Java EE web development related work. Download & Installation – The installation procedures for all three tools are simple enough. You either have to run an installer or have to extract a compressed file and you are ready to go. Downloading NetBeans and JDeveloper is easier than Eclipse as Eclipse has one of the most confusing websites around. 10s of projects and 100s of download possibilities. Speed – JDeveloper took the most time to start while Eclipse took the least. NetBeans was a close second. Must add that NetBeans 6.1 is the fastestNetBeans I have used. I am running a Core2Duo, Windows Vista with 2GB RAM. Startup time has improved significantly and even after it starts, the UI is fast and responsive. Although I have installed the heaviest NetBeans available (185MB ‘All’ Package) I don’t find it sluggish. So it looks like NetBeans has sorted out the main issue on which it has got hammered over the years. Look & Feel – The definition of a good look and feel varies from person to person. My view is that Eclipse is superior than both JDeveloper and NetBeans. Eclipse is fast, clean and crisp. NetBeans and JDeveloper are powerful but definitely not good looking. JavaEE Ready – The NetBeans installer includes a Glassfish and a Tomcat server while Oracle JDeveloper comes with an embedded Oracle Application Server (OC4J). On both IDEs you can create JavaEE files like servlets, jsps and jsf, ejb and and run them without any additional installation or effort. NetBeans and JDeveloper also provided built-in support for everything I could think of, from UML, Web Services, BPEL tools to Refactoring, Reverse Engineering and the works. Eclipse for JEE was nowhere near. When you download the Eclipse version for JEE Developers, at a minimum you would expect your servlets to compile. They don’t. Eclipse comes with built-in adapters for integrating with IBM Oracle, ObjectWeb and JBoss servers but none for the JEE reference implementation, Glassfish. You need to separately download and configure the server adapter for Glassfish. Only after you configure the adapter does the Eclipse JEE version really starts to function. Only IDE – A mouseover on the icon for Netbeans 6.1 pops up a message “The Only IDE you need”. That’s a bold statement to make, considering that Java developers take no prisoners when it comes to the Java IDE wars. I thought both JDeveloper and NetBeans were very close to being the only IDE you need. Eclipse unfortunately is nowhere near out-of-the-box. By Eclipse I mean the Eclipse available on the Eclipse site and not Eclipse based distros or Eclipse based tools from vendors like BEA, IBM, MyEclipse, Codegear, etc. These tools are far easier and friendlier to use than the Eclipse downloads. One wonders if the Eclipse downloads are intentionally kept incomplete so as to not compete with Eclipse based products from Eclipse partners. Codegear for example has a study put up on their site which provides stats showing how all Eclipse based IDEs are superior to the Eclipse you get from the Eclipse site. Perhaps this is the reason why Eclipse downloads will never be ready-to-go / out of the box. Third Party Tools and Plugins – Eclipse has a far superior range of plugins available than those available for NetBeans and JDeveloper. All popular tools have some kind of Eclipse plugin available and even creators of lesser known tools and frameworks make it a point to build an Eclipse plugin for their software. These third party plugins are the strongest factor working in favor of Eclipse. With NetBeans and JDeveloper most of the plugins come from Sun and Oracle respectively. Development Environment For Teams – You make the installers for NetBeans 6.1 or JDeveloper 11g available to all members in the team and you can be fairly sure that most if not all your JEE stuff will work on all machines. With Eclipse for JEE you invariably have to download several missing and additional components before you have a development environment ready. As most in the developing world are using slow internet connections if any, having to download missing plugins and adapters is very irritating. Hand Holding – NetBeans 6.1 seems willing to hold your hand and help you along the Java EE learning curve. The IDE comes with sample applications for EJB, UML, JSF. This is a useful feature of NetBeans because when you start using an IDE you aren’t sure how the IDE organizes stuff and what a real application developed in the IDE will look like. With NetBeans you can create and run a proper Java EE app in about 3 clicks and then analyze how it is created and organized by the IDE. Eclipse and JDeveloper also have good documentation but having a range of sample applications is a plus for NetBeans. JSF Support – Visual Web JSF is pitched as an important feature of NetBeans. I did not like it much as it seemed like a NetBeans specific thing. For non visual web JSF, NetBeans did not have any special features. The faces-config.xml editor in NetBeans was not that great. It works better for visual web JSF than for other JSF. JDeveloper is the best equipped for JSF development. Unlike NetBeans, the bindings and beans generated by JDeveloper did not use any Oracle or JDeveloper specific libraries. Also visual editing for JSF in JDeveloper seems the most advanced. Eclipse has a decent JSF support and faces-config.xml editor. Verdict – 1. If you are just starting with JEE, I would suggest that you go with the full version of NetBeans 6.1. 2. If you use a lot of other Oracle software in the organization, JDeveloper makes it easiest to bring all things together. 3. If you are IDE neutral at the start of a project, I will suggest that you choose between NetBeans and JDeveloper. 4. On projects where you have Eclipse familiarity on the team and will be using plugins for tools / frameworks, go for an Eclipse based commercial IDE if you have the budget for it. If not use an Eclipse distro. Would recommend against using the Eclipse JEE download and then trying to build the Eclipse IDE you require. This can be especially painful if you have a large team. Java Web Development. A blog about Java and Java2EE based technologies. Find Oracle ADF tutorial, Primefaces Tutorial, RichFaces tutorial, Oracle Webcenter tutorial, EJB, JPA, JSF, JSP, Servlet, Mobile Application Development, GlassFish Server, TomCat Server, Weblogic Application Server, JDeveloper IDE, NetBeans IDE, Eclipse IDE. Home Oracle ADF PrimeFaces Tutorial Java EE 6 with Eclipse IDE Java EE 6 Video Tutorial JSF-2 Tutorials. Sunday, June 10, 2012. How to install JDeveloper 11g IDE, ADF Run time and Web Logic Server. Oracle JDeveloper IDE is a free IDE (integrated development environment) by Oracle which simplifies and speed up the Java applications development, Java EE web applications development, Oracle ADF web applications development, Oracle ADF mobile application development and Java based SOA applications development. It is very famous java software development tool which offer the end to end development of and Fuion Application with support of full software development life cycle. It has visually and code view for development of JSF, Html, JSP, EJB, JPA, Oracle ADF Business components, oracle ADF, SOA and Java interface etc. Here I am going to share this post for how to install the JDeveloper 11g, Oracle ADF Run Time and integrated Oracle Weblogic application Server on Windows platform. Step by step instructions with pictures are showing for complete installation. There is also option to customize the installation to install only JDeveloper and ADF Run time or WebLogic app Server and ADF Run time. 1- Below is the Download page for Oracle JDeveloper 11g. Accept the license agreement, Downloading will start after clicking the download file button. Save the file at your specific folder / location. 2- To start installation, double click the Jdeveloper Studio setup file. 3- Jdeveloper Studio Installation has been started. 6- To customize the features, click on custom otherwise click typical to install all products JDeveloper, ADF Run time and Weblogic server. Give the Installation directories for installation of JDeveloper and Weblogic server. 8- Here you can manage the user access for JDeveloper access. By default, it is checked for all users of your computer machine. 10- Oracle installer has started the installation of JDeveloper and weblogic app server. 11- Congratulation JDeveloper and Weblogic server Installation has been completed. Click at done to finish the installation. 12- This is Quick Start View, here you can configure the Web Logic application Server to create a starter domain using the configuration wizard. You can use the starter domain to explore the weblogic server. Here you can start Oracle JDeveloper 11g, to configure domains for oracle ADF and can access Jdevleoper documents. 13- You can also start JDeveloper from Start -> All Programs -> Oracle Fusion Middleware -> JDeveloper Studio. 14- Below figure is showing the JDeveloper start page. Now you can use your JDeveloper IDE for Oracle ADF Applications development, Java 2 EE web applications development, oracle adf mobile Applications development, java SOA Applications development, database designing and development and much more. Creating a Java Web Start JNLP Definition for Java Clients. You use the Java Web Start Wizard to create the XML-based JNLP (Java Network Launching Protocol) definition file that the Java Web Start software uses to download and run Java applications and applets on client machines. Note: You must download and install the Java Web Start software from the http://java.sun.com/products/javawebstart/ web site to launch applications and applets with Java Web Start in JDeveloper. Users of your application or applet will also be required to install the software on their machines. The application or applet must be delivered in a set of JAR files and all application resources, such as images, configuration files and Native libraries, must be included in the JAR files. The resources must be looked up using the ClassLoader getResource or another method. Java Web Start only transfers JAR files from the to the client. Please refer to the Java Web Start documentation available from (use the link above) for additional information. The wizard adds a JNLP file and (optionally) an HTML file to your project. Java Web Start will use these generated files to determine what application source to download from the web server: The Java Network Launching Protocol (JNLP) definition is required by Java Web Start to download and launch the application. The .jnlp file describes the archive files and whether it includes an applet or an application An HTML file. Although HMTL file creation is optional, it is highly recommended unless you intend to create the file manually. The HTML file contains the URL to initiate the downloading from the web server to the client. Before you launch the Java Web Start Wizard to create the JNLP and HTML files, you must create a simple archive (JAR) file for it. You must also know in which class the main function can be found, as you will be asked to specify this. To create the JNLP definition for your application or applet: In the Navigator, select the project in which you want to generate a JNLP definition. Choose F ile N ew to open the New Gallery. In the ategories tree, expand Client Tier and select Swing/AWT . In the I tems list, double-click Java Web Start (JNLP) Files to open the Java Web Start wizard. Click N ext in the Welcome page. In the Application Information page, enter the file name, the name and location of the jar file that you created, and the class that you want to use to run your application. For detailed help in using the Java Web Start wizard, press F1 or click H elp from within the wizard. You can also use a JSP file or servlet with Java Web Start, however, you will have to manually configure the file and change the content type. Here is an example JNLP with contentType = application/x-java-jnlp-file , specified in the first line: