• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to build/run jsf code?

 
Jolie Lee
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i downloaded a simple jsf code, import it in eclipse, but i've no idea how to run it and test it..

can anyone help me?
 
Sergey Smirnov
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Istead of simple java application, you cannot just launch the main method of the starter class. You have to deploy the application in the servlet container and that launch the application using an internet browser. The way how to do it depends of what the jsf code you have. Check it. Probably, it has a build.xml file with deployment target in it.
I suggest,it will be more convenient for you to use some Eclipse plugins as soon as you use Eclipse. Those plugins allow to simplify the process.
One of the plugins is Sysdeo. It allows to deploy application into Tomcat and launch it and/or debug it.
There are several JSF-oriented plugins based on Eclipse:
Exadel Studio is a free Eclipse-based IDE. It allows to create, develop, deploy, run and debug jsf application.
FacesIDE - lightweight IDE that has some subset of Exadel Studio plus faces-config verification. Together with Sysdeo plugins it also provides full cycle from creating to deploing and launching. FacesIDE is also free.
From the commercial plugins, most chipest is MyEclipse - ~$29.95, then - Exadel Studio Pro - $99.00. More expensive are M7 NitroX and IBM WSAD.
It is about Eclipse. From the non-Eclipse enviromnent, the nost popular one is Sun's Java Studio Creator. For full list of IDE and plugins look at: http://www.jamesholmes.com/JavaServerFaces/#software-gui

--
Sergey : jsfTutorials.net
 
Jolie Lee
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI thanks for the reply.

i'm currently using eclipse, and also the exadel.

the code i have now doens't have a build.xml, should i write my own build.xml?

and also, if im' going to use JSF, is there certain directory structure that i need to follow?
 
Sergey Smirnov
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you speak about run-time application structure, it has some pre-defined structure. You do not have to have exactly the same structure when you develop the project. Instead of it, you can rearrange the files and folders and create a war and deploy it toward servlet container. Using ant script (build.xml) is most common way to do so.
However, you can simplify the process, having a structure similar to the structure of the war file. Some servlet containers are enable for null-deployment. I.e. ability to launch the application from the place where it is developed. Having the build.xml is not required in this case. Exadel uses null-deployment. Just for kick start do the following:
1. From the Eclipse menu, select File->New->Project then Exadel Studio->JSF->JSF Project
2. On the first screen of the wizard, type any name and select JSFKickStart as a template
3. Click Next
On the second screen, wizard ask you about Registering Web Context in the server.xml This means register your new application under Tomcat for null-deployment. Leave the checkbox checked.
4. Click Finish
Exadel Studio create a ready-to-launch simple JSF application for you. To launch the application:
5. Run the Tomcat using the green arrow at the Eclipse toolbar.
6. Select the new created project in the Package Explorer tree and then click the Launch Application button (Running Man near Butterfly) from the Eclipse toolbar.
The browser with running application should appear.
Close the browser and return back to the Eclipse. Overview the structure, Exadel Studio created for you. (It is more convenient to switch to the Eclipse Resource Perspective, because the Package Explorer on this perspective shows unfiltered tree structure). The project contains WebContext folder. It is top point of the application. (WebContext is not a reserved name, it my be different in your own application). This folder is registered in the Tomcat server.xml as a context folder for your application. WebContext folder contains WEB-INF folder (this name is reserved). WEB-INF contains 'classes' and 'lib' folders and faces-config.xml and web.xml

Let's return back to your previous project you imported. Does it have the similar structure? If so, it is ready for null-deployment. Right click on the project root and select Exadel Studio -> Register Web Context in Tomcat from the context menu (actually, if you import the project with Import JSF Project wizard, the project might be already registered). Stop Tomcat from the toolbar, then start it again. Launch the application with "Running Man on Butterfly" button.

--
Sergey : jsfTutorials.net
[ June 15, 2005: Message edited by: Sergey Smirnov ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!