developer.com
Search EarthWeb
CodeGuru | Gamelan | Jars | Wireless | Discussions
Navigate developer.com
Architecture & Design  
Database  
Java
Languages & Tools
Microsoft & .NET
Open Source  
Project Management  
Security  
Techniques  
Voice  
Web Services  
Wireless/Mobile
XML  
New
 
Technology Jobs  

   Developer.com Webcasts:
  The Impact of Coding Standards and Code Reviews

  Project Management for the Developer

  Defining Your Own Software Development Methodology

  more Webcasts...




Return in early January to see which technologies and products won.




Developer Jobs

Be a Commerce Partner














 


Developer News -
Shifts for Enterprise Linux, Green Networks in '09    December 26, 2008
Gifts for All in Linux 2.6.28    December 24, 2008
Merb Merges With Rails    December 24, 2008
Sun's Unwired Motherboard Plans    December 24, 2008
Free Tech Newsletter -

Dissecting Java Page Flows
By Kunal Mittal & Srinivas Kanchanavally

Go to page: Prev  1  2  3  Next  

Page Flows in Apache Beehive

The HelloWorld example in Beehive looks a little different from the WebLogic Workshop version. Let's first look at the controller in Listing 3.

Listing 3. helloworld.jpf in Apache Beehive

import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
import org.apache.beehive.netui.pageflow.Forward;
@Jpf.Controller (
   simpleActions={
      @Jpf.SimpleAction (name="cancel", path="begin.do")
      }
)
public class HelloWorldController extends PageFlowController
{
@Jpf.Action (
   forwards={
      @Jpf.Forward (name="success", path="helloworld.jsp")
      }
)
public Forward begin()
{
   return new Forward("success");}

You'll immediately notice that this version of the Java Page Flow is a lot shorter and crisper. All the Javadocs annotations at the beginning of the class code are no longer needed in the Apache Beehive version. Listing 4 shows the JSP that goes with this controller.

Listing 4. helloworld.jsp in Apache Beehive

<%@page language="java" contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://beehive.apache.org/netui/tags-html-1.0"
          prefix="netui"%>
<netui:html>
   <head>
      <title>beehive - hello world</title>
      <netui:base/>
   </head>
   <netui:body>
      <p>
         Hello World !!
         <br>
      </p>
   </netui:body>
</netui:html>

The "How to Run the Sample Code" sidebar will show you how to set up and run this example in your own environment.

HOW TO RUN THE SAMPLE CODE

Use the following steps to set up and run the HelloWorld example in your own environment.

Make a Project Folder

First, make sure you've read Appendix A. Then, on your C: drive, create a directory named beehive-projects. In the beehive-projects directory, create a directory named helloworld. Before proceeding, confirm that the following directory structure exists:

C:\
   beehive-projects
      helloworld

Copy Runtime JARs to the Project Folder

Copy the folder BEEHIVE_HOME/samples/netui-blank/resources into your project folder, C:\beehive_projects \helloworld. BEEHIVE_HOME is the top-level folder of your Beehive installation, as explained in Appendix A.

Copy the folder BEEHIVE_HOME/samples/netui-blank/WEB-INF into your project folder, C:\beehive-projects \helloworld.

Now, assemble the runtime resources for your Page Flow application. The runtime JARs include the Page Flow runtime, the NetUI tag library, and so on. You can load these resources into your project's WEB-INF/lib folder using the following Ant command at the command prompt:

ant -f %BEEHIVE_HOME%\ant\buildWebapp.xml
    -Dwebapp.dir=C:\beehive-projects
                   \helloworld deploy.beehive.webapp.runtime

This command will copy all JAR files to the WEB-INF/lib directory. Next, create the controller file, the central file for any Page Flow. Then, in the directory C:/beehive-projects/helloworld, create a file named HelloWorldController.jpf. In a text editor (or your IDE of choice), open the file HelloWorldController.jpf. In the directory C:/beehive-projects/helloworld, create a file named helloworld.jsp.

Compile and Deploy the Page Flow

You're now ready to compile the Page Flow and deploy it to Tomcat. Start the Tomcat server. Using the command shell opened in the previous step, at the command prompt, enter the following:

ant -f %BEEHIVE_HOME%\ant\buildWebapp.xml
    -Dwebapp.dir=C:\beehive-projects \helloworld
    -Dcontext.path=helloworld build.webapp deploy

To undeploy the application, use the following Ant command:

ant -f %BEEHIVE_HOME%\ant\buildWebapp.xml
    -Dwebapp.dir=C:\beehive-projects \helloworld
    -Dcontext.path=helloworld undeploy

Go to page: Prev  1  2  3  Next  


Tools:
Add www.developer.com to your favorites
Add www.developer.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed


Architecture & Design Archives






internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers