<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Have Your Cake and Eat It Too : Forge Tools
</h3>
<span style="margin-bottom: 10px;">
    modified by <a href="http://community.jboss.org/people/koen.aers">Koen Aers</a> in <i>JBoss Tools</i> - <a href="http://community.jboss.org/community/tools/blog/2011/05/11/have-your-cake-and-eat-it-too-forge-tools">View the full blog post</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p style="text-align: left;">As I <a class="" href="http://community.jboss.org/en/tools/blog/2011/01/27/forging-of-the-forge-tools">reported earlier</a> I am currently working on the integration of Forge in JBoss Tools. <a class="jive-link-external-small" href="http://vimeo.com/22463907">Lincoln's excellent screencast</a> inspired me to write up a tutorial that shows how his work looks in the context of JBoss Tools. For the people that are too busy to read through the entire post and prefer to watch a movie, I have recorded a short version. In true Hollywood style, this is basically a remake of Lincoln's version. We will create, deploy and debug a simple JEE web application on JBoss AS but this time using JBoss Tools.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="text-align: center;"><object height="350" width="425"><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=video&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1"/><param name="wmode" value="transparent"/><embed allowfullscreen="true" allowscriptaccess="always" height="350" src="http://www.vimeo.com/moogaloop.swf?clip_id=video&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" width="425" wmode="transparent"></embed></object></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="text-align: left;">Now for the brave among you. Let's see the detailed steps on how to do this yourself...</p><h1>Setting Up</h1><p>If you want to try out the different steps in this article the first piece of software you will need to install is JBoss AS. I recommend to <a class="jive-link-external-small" href="http://sourceforge.net/projects/jboss/files/JBoss/JBoss-6.0.0.Final/">download AS 6 Final</a> and extract it into your place of choice. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The other item that you need is JBoss Tools. We are going to live on the bleeding edge and use a nightly build of JBoss Tools 3.3 which embeds a snapshot of the Forge runtime. A word of warning is in its place here: as usual when using nightlies and alpha software it is very well possible that things are broken. If this would happen please don't get frustrated and try again some time later. Or even better, report the issue on the <a class="" href="http://community.jboss.org/en/tools?view=discussions">JBoss Tools Forum</a><span> or on the Forge mailing list (</span><a class="jive-link-email-small" href="mailto:forge-users@lists.jboss.org" target="_blank">forge-users@lists.jboss.org</a><span>). </span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I assume, dear reader, that you are hardcore enough not to be scared away by these minor inconveniences and are ready to download the <a class="jive-link-external-small" href="http://www.eclipse.org/downloads/packages/release/indigo/m6">Indigo M6 release of the Eclipse IDE for Java EE Developers</a>. Extract the archive into your place of choice and fire up the Eclipse IDE. The screenshot below shows you what the installation folder looks like on my machine.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16284/installation_layout.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16284/450-246/installation_layout.png </span></a></p><p>When this is done let's go ahead and install the appropriate elements of JBoss Tools. To do this, we select <span style="font-family: terminal, monaco; font-size: 8pt;">Help-&gt;Install New Software</span>. To avoid clashes between the JBoss Tools and Eclipse Indigo update sites we have to disable the latter. Click on the <span style="font-family: terminal, monaco; font-size: 8pt;">Available Software Sites</span> link and uncheck the <span style="font-family: terminal, monaco; font-size: 8pt;">Indigo</span> entry. </p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16357/available_software_sites.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16357/450-125/available_software_sites.png </span></a></p><p>After this, we enter the address of the <a class="jive-link-external-small" href="http://download.jboss.org/jbosstools/updates/nightly/trunk/">JBoss Tools nightly update site</a> in the <span style="font-family: terminal, monaco; font-size: 8pt;">Work with:</span> text field. In the resulting list of available software elements we select <span style="font-family: terminal, monaco; font-size: 8pt;">Maven Support</span> and <span style="font-family: terminal, monaco; font-size: 8pt;">Web and Java EE Development</span>. This is illustrated in the screenshot below.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16285/install_jboss_tools.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16285/450-359/install_jboss_tools.png </span></a></p><p>The rest of this installation is pretty straightforward. We press <span style="font-family: terminal, monaco; font-size: 8pt;">Next&gt;</span> and wait until all the needed dependencies have been calculated. Then we press <span style="font-family: terminal, monaco; font-size: 8pt;">Next&gt;</span> again on the <span style="font-family: terminal, monaco; font-size: 8pt;">Installation Details</span> page, we accept the license agreements on the <span style="font-family: terminal, monaco; font-size: 8pt;">Review Licenses</span> page and press <span style="font-family: terminal, monaco; font-size: 8pt;">Finish</span> to launch the process that will download the required packages. We press <span style="font-family: terminal, monaco; font-size: 8pt;">OK</span> when the security warning appears and <span style="font-family: terminal, monaco; font-size: 8pt;">Restart Now</span> when prompted. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Now we are ready for the next step which will be to configure and start the application server.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h1>Configuring the Application Server</h1><p>In order to debug a webapp in our running server we need to make JBoss Tools aware of the server. The first step to do this is bring up the context menu in the <span style="font-family: terminal, monaco; font-size: 8pt;">Servers</span> view and select <span style="font-family: terminal, monaco; font-size: 8pt;">New-&gt;Server</span>.</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16286/new_server.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16286/259-98/new_server.png </span></a>The <span style="font-family: terminal, monaco; font-size: 8pt;">New Server</span> wizard opens. On the first page of this wizard we select <span style="font-family: terminal, monaco; font-size: 8pt;">JBoss Community-&gt;JBoss AS 6.0</span> as the server type and push the <span style="font-family: terminal, monaco; font-size: 8pt;">Next&gt; </span>button. The only thing we still need to do is specify the folder where we extracted the previously downloaded JBoss AS 6 archive in the <span style="font-family: terminal, monaco; font-size: 8pt;">Home Directory</span> text field. The situation on my machine is illustrated in the screenshot below.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16287/JBoss_Runtime.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16287/450-472/JBoss_Runtime.png </span></a></p><p>We leave all the default settings and push the <span style="font-family: terminal, monaco; font-size: 8pt;">Finish</span> button to close the wizard. The newly configured server shows up in the <span style="font-family: terminal, monaco; font-size: 8pt;">Servers</span> view. The only thing that we still need to do is launch it by selecting this new server, bringing up the context menu. Since we want to debug our application we will select <span style="font-family: terminal, monaco; font-size: 8pt;">Debug</span> to launch it in debug mode.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16289/debug_server.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16289/450-87/debug_server.png </span></a></p><p>The <span style="font-family: terminal, monaco; font-size: 8pt;">Console</span> view opens and shows the console messages generated by the starting application server. After some time our server is up and running and we are ready to roll.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h1>First Forge Steps</h1><p>Until now we haven't seen any sign of our beloved Forge project. Let's change that and open up the Forge console by selecting <span style="font-family: terminal, monaco; font-size: 8pt;">Window-&gt;Show View-&gt;Other...</span> and then <span style="font-family: terminal, monaco; font-size: 8pt;">Forge-&gt;Forge Console</span> as illustrated above. The Forge Console view opens. An image of that is shown below. </p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16292/start_forge.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16292/450-103/start_forge.png </span></a> </p><p>As you can see there are two buttons in the top left corner of this view as well as a drop down menu with two entries to start and stop our Forge runtime. Go ahead and select either the green arrow or the 'Start Forge' entry from the menu. After some time the Forge start banner should appear and Forge is prompting for input. Entering the <span style="font-family: terminal, monaco; font-size: 8pt;">pwd</span> command should indicate the path to your current workspace.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16293/forge_banner.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16293/450-103/forge_banner.png </span></a></p><p>It can sometimes be unclear to a beginning user as to what commands you can issue at a particular moment when working with Forge. Luckily there are a number of tools at your disposal that can help at this point. Typing a tab character can help you at any time. When you do this at an empty prompt Forge will give you a list of commands that can be used at that particular scope. Below you see the list that is produced when we type a tab character at this time.</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16295/tab_character.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16295/450-103/tab_character.png </span></a></p><p>You can also use the tab character when in the middle of typing a command. When there are multiple choices Forge will list all the possibilities but when there is only one possibility Forge will complete your command. Furthermore, as you can see, there is the <span style="font-family: terminal, monaco; font-size: 8pt;">list-commands</span> command. This will print the commands applicable in the current scope listed by category. If you use this command with the <span style="font-family: terminal, monaco; font-size: 8pt;">--all</span> option, it will list all the possible commands disregarding the current scope. The ones that are applicable in the current scope are marked with an asterisk.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16296/list_commands_all.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16296/450-385/list_commands_all.png </span></a></p><p>Before we start the interesting work, it is worth mentioning one last thing. The Forge runtime that we are currently working with is embedded in JBoss Tools. Currently this is a snapshot build that removes some of the issues that were present in the 1.0.0.Alpha3 release. Of course it is probable that at one time you will want to change the provided runtime. You can do so by opening the <span style="font-family: terminal, monaco; font-size: 8pt;">Installed Forge Runtimes</span> preferences page. On this page you can add new runtimes and select the one that you want to use.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16294/forge_preferences.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16294/450-364/forge_preferences.png </span></a></p><p>Now that we have covered the basics, it is time for some real work. Let's create an example project.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h1>Creating the Example Project</h1><p>Surprisingly enough or not, to create a new project, you need to use the <span style="font-family: terminal, monaco; font-size: 8pt;">new-project</span> command. This command has two important parameters: the name of the project itself and the fully qualified name of the top level package. Using the tab character is really convenient as you will quickly learn when using Forge for a while as it reduces the long command illustrated below to just a few key presses. Of course you will still have to write the respective names.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16297/new_project.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16297/450-113/new_project.png </span></a></p><p>We accept the default project directory that Forge presents us by pressing enter once again. At this time the Forge runtime starts off creating a project with a typical Maven layout. When this is done JBoss Tools will automatically import this newly created project into the current workspace. The result is shown in the screenshot below.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16298/after_project_import.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16298/450-360/after_project_import.png </span></a></p><p>As you can see, this went really very smoothly. But let's make it even more interesting by creating an entity.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h1>Adding the Customer Entity</h1><p>Adding an entity is done using the <span style="font-family: terminal, monaco; font-size: 8pt;">entity</span> command. At this time, in the current scope, the 'entity' command is not enabled. We first have to setup the persistence. This is done using the <span style="font-family: terminal, monaco; font-size: 8pt;">persistence setup</span> command. We will need to specify the JPA provider for which we choose Hibernate and the target container which will be JBoss AS 6. The full command to issue is <span style="font-family: terminal, monaco; font-size: 8pt;">persistence setup --provider HIBERNATE --container JBOSS_AS6</span>.</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16299/persistence_setup.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16299/450-113/persistence_setup.png </span></a>As you can see we have the opportunity to accept support for the extended APIs which we will do. When prompted we select version 3.6.4.Final of Hibernate. As shown below, an editor opens and shows the generated <span style="font-family: terminal, monaco; font-size: 8pt;">persistence.xml</span> file.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16302/entity_command.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16302/450-360/entity_command.png </span></a></p><p>Now the we can create entities. As shown above we issue the following command <span style="font-family: terminal, monaco; font-size: 8pt;">entity --named Customer</span>. We will be lazy again and accept the proposed default package. This time the java editor opens on the generated <span style="font-family: terminal, monaco; font-size: 8pt;">Customer.java</span> file.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16303/field_command.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16303/450-360/field_command.png </span></a></p><p>Next we will create two fields in our <span style="font-family: terminal, monaco; font-size: 8pt;">Customer</span> class. One for the first name and one for the last name of the customer. The two commands to be issued are <span style="font-family: terminal, monaco; font-size: 8pt;">field string --named firstName</span> and <span style="font-family: terminal, monaco; font-size: 8pt;">field string --named lastName</span>. Observe how the newly created fields get selected in the editor and the outline view.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16304/after_adding_fields.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16304/450-360/after_adding_fields.png </span></a></p><p>Now that we have our <span style="font-family: terminal, monaco; font-size: 8pt;">Customer</span> class, let's develop the user interface. We want to make use of PrettyFaces to provide us with pretty URLs. Fortunately for us, there is a Forge plugin for PrettyFaces that we can use. As a bonus it will enable us to show how to install additional plugins into Forge.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h1>Adding the PrettyFaces Plugin</h1><p>The commands available in Forge are provided by plugins. The Forge runtime embedded in JBoss Tools comes with a number of standard plugins that provide us with the commands that were shown earlier when we tried the <span style="font-family: terminal, monaco; font-size: 8pt;">list-commands --all</span> command. The <span style="font-family: terminal, monaco; font-size: 8pt;">prettyfaces setup </span>command which we need to use if we want to enable PrettyFaces in our example project is not one of those standard commands. Luckily the list of Forge commands is extensible. To do so we can install plugins with the <span style="font-family: terminal, monaco; font-size: 8pt;">forge</span> command. There are a number of different ways to install those plugins such as providing a jar file or a Maven identifier. We are going to install our PrettyFaces plugin using git. As shown below we issue the <span style="font-family: terminal, monaco; font-size: 8pt;">forge git-plugin git://github.com/ocpsoft/prettyfaces-forge-plugin.git</span> command. </p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16310/install_prettyfaces.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16310/450-113/install_prettyfaces.png </span></a></p><p>Forge will start by checking out the plugin source code into a temporary folder, launch Maven on the checked out code to build the plugin and then install the plugin in the <span style="font-family: terminal, monaco; font-size: 8pt;">~/.forge</span> folder. It will then restart Forge so that the new plugin is available. </p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16309/prettyfaces_installed.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16309/450-113/prettyfaces_installed.png </span></a></p><p>Now that our prettyfaces plugin is installed, we can start using it. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h1>PrettyFaces in the Example Project </h1><p>We start of where we left earlier and setup PrettyFaces for our example project by issuing the command <span style="font-family: terminal, monaco; font-size: 8pt;">prettyfaces setup</span>. Forge will ask us if it's OK to change the packaging from 'jar' to 'war', which we accept.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16316/prettyfaces_setup.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16316/450-113/prettyfaces_setup.png </span></a></p><p>After that we need to choose the technology to use for our application. We choose <span style="font-family: terminal, monaco; font-size: 8pt;">Java EE 6 and Servlet &gt;= 3.0</span>.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16317/prettyfaces_technology.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16317/450-113/prettyfaces_technology.png </span></a></p><p>The last thing Forge asks from us is to choose the version of PrettyFaces that we want to use. We choose version 3.2.1. The <span style="font-family: terminal, monaco; font-size: 8pt;">pretty-config.xml </span>file opens in an xml editor. Also notice how the layout of the project changes. This is because setting up PrettyFaces has changed our packaging from 'jar' to 'war'. The Eclipse Maven integration picks this up and the Forge Tools automatically update the project configuration accordingly.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16353/prettyfaces_installed.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16353/450-337/prettyfaces_installed.png </span></a></p><p>Now we are sure we will be able to create pretty urls and we are ready to scaffold our Customer application.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h1>Scaffolding the Example Application</h1><p>The first thing to do is setup scaffolding. We issue the <span style="font-family: terminal, monaco; font-size: 8pt;">scaffold setup</span> command and accept the default for the scaffold type and instruct Forge to install the scaffold provider for our project.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16324/scaffold_setup.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16324/450-113/scaffold_setup.png </span></a></p><p>We install version 1.15 of Metawidget and version 3.0.0.Final of Seam Persistence.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16325/scaffold_versions.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16325/450-128/scaffold_versions.png </span></a></p><p>We accept the index.html file to be overwritten and choose to generate a pretty URL ('<span style="font-family: terminal, monaco; font-size: 8pt;">/</span>') for the combination of the <span style="font-family: terminal, monaco; font-size: 8pt;">index.xhtml</span> resource and the <span style="font-family: terminal, monaco; font-size: 8pt;">/index.jsf</span> URL.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16356/scaffold_index.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16356/450-238/scaffold_index.png </span></a></p><p style="text-align: left;">Now we need to scaffold the user interface for the Customer entity. We can do this by issuing the <span style="font-family: terminal, monaco; font-size: 8pt;">scaffold from-entity</span> command. We again accept the default for the scaffold type and then generate the following URL combinations:</p><ul><li><span style="font-family: terminal, monaco; font-size: 8pt;">/customer/view -&gt; /faces/scaffold/customer/view.xhtml</span> for the <span style="font-family: terminal, monaco; font-size: 8pt;">view.xhtml </span>resource.</li><li><span style="font-family: terminal, monaco; font-size: 8pt;">/customer/create -&gt; /faces/scaffold/customer/create.xhtml</span> for the <span style="font-family: terminal, monaco; font-size: 8pt;">create.xhtml</span> resource</li><li><span style="font-family: terminal, monaco; font-size: 8pt;">/customer/list -&gt; /faces/scaffold/customer/list.xhtml</span> for the <span style="font-family: terminal, monaco; font-size: 8pt;">list.xhtml</span> resource</li></ul><p>The process is illustrated below for the first one of these.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16358/scaffold_from_entity.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16358/450-177/scaffold_from_entity.png </span></a></p><p>After this, we can proceed by building and deploying our application.</p><p><strong><br/></strong></p><h1>Building and Deploying</h1><p>Building the application is only a matter of entering the <span style="font-family: terminal, monaco; font-size: 8pt;">build</span> command. This will invoke Maven and build the project. </p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16359/mark_as_deployable.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16359/450-337/mark_as_deployable.png </span></a></p><p style="text-align: left;">When the build is finished, we navigate to the created <span style="font-family: terminal, monaco; font-size: 8pt;">example.war</span> artefact in the target folder, bring up the context menu on this file and select <span style="font-family: terminal, monaco; font-size: 8pt;">Mark as Deployable</span>. After that, we bring up the context menu a second time on this file and select <span style="font-family: terminal, monaco; font-size: 8pt;">Debug As-&gt;Debug on Server</span>.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16360/debug_on_server.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16360/450-114/debug_on_server.png </span></a></p><p style="text-align: left;">The <span style="font-family: terminal, monaco; font-size: 8pt;">Debug on Server </span>wizard pops up. We select our <span style="font-family: terminal, monaco; font-size: 8pt;">JBoss AS 6 Runtime Server</span> that we configured in the beginning and push the <span style="font-family: terminal, monaco; font-size: 8pt;">Finish</span> button. The Eclipse console view should appear, showing the activity of the server while it is deploying our application. </p><p style="text-align: left;">When deployment is finished, we are ready to see how debugging works.</p><p style="text-align: left;"><strong><br/></strong></p><h1>Debugging the Application</h1><p>Let's put a breakpoint <span style="font-family: terminal, monaco; font-size: 8pt;">setLastName</span> method of our <span style="font-family: terminal, monaco; font-size: 8pt;">Customer</span> class.</p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16361/breakpoint.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16361/443-81/breakpoint.png </span></a></p><p style="text-align: left;">Next we open the Eclipse browser window by clicking the globe icon in the toolbar and enter the URL of our application: <span style="font-family: terminal, monaco; font-size: 8pt;"><a class="jive-link-external-small" href="http://localhost:8080/example/customer/list" target="_blank">http://localhost:8080/example/customer/list</a></span>. </p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16362/webbrowser.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16362/449-426/webbrowser.png </span></a></p><p style="text-align: left;">As expected there are no customers in our database. Let's change this by pushing the <span style="font-family: terminal, monaco; font-size: 8pt;">Create new</span> button. On the next screen we enter the first and last names of our first customer and press <span style="font-family: terminal, monaco; font-size: 8pt;">Create</span>. </p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16364/kermit_frog.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16364/450-202/kermit_frog.png </span></a></p><p style="text-align: left;">We are prompted by Eclipse to change to the Debug perspective and as expected, our application is halted on the breakpoint tht we set a moment ago. </p><p style="text-align: center;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3794-16365/debug.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3794-16365/450-337/debug.png </span></a></p><p style="text-align: left;">Now we can do all the things developers do while debugging applications. I encourage you to remove the breakpoint and push the <span style="font-family: terminal, monaco; font-size: 8pt;">Resume</span> button (or F8) to continue the application, play around and see how Forge created a basic CRUD user interface for our Customer entity. For me the time has come to finish this long article and come to a conclusion.</p><p style="text-align: left;"><strong><br/></strong></p><h1>Conclusion</h1><p>In this article I have tried to illustrate how easy it is to get started with Forge to create, deploy and debug a JEE application. Also, I have tried to show you how developers can benefit greatly of the combined power of a command line oriented interface that is integrated in a full featured IDE. As you have seen, the IDE can provide immediate feedback of what happened by issuing the commands at the command line in the Forge Console view.</p><p><span>Finally, I would encourage you to test drive Forge and its JBoss Tools integration and provide us with all you feedback. For that you can use the Forge mailing list (</span><a class="jive-link-email-small" href="mailto:forge-users@lists.jboss.org" target="_blank">forge-users@lists.jboss.org</a><span>) as well as the </span><a class="" href="http://community.jboss.org/en/tools?view=discussions">JBoss Tools discussion forum</a>. Bugs and feature requests can be filed against the <a class="jive-link-external-small" href="https://issues.jboss.org/browse/SEAMFORGE">Forge</a> or the <a class="jive-link-external-small" href="http://">JBoss Tools</a> issue trackers.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Happy Forging!</p><p>Koen</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Comment by <a href="http://community.jboss.org/community/tools/blog/2011/05/11/have-your-cake-and-eat-it-too-forge-tools">going to Community</a></p>

</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>