Part 1. Getting Started with Web Development using Eclipse
This is the first in a two part article that looks at using Eclipse as a development environment for developing web applications that use the BusinessObjects XI3 Java SDK.
Eclipse is one of the leading development environments for Java applications and indeed other technologies such as C++ and is packed with features that greatly improve productivity and team working. What’s more as it is open source it is free!
The first article in this series looks at how to install and configure Eclipse for web development and the second article then looks at how to reference the BusinessObjects Java SDK in order to develop a BusinessObjects web application.
Contents
- Prerequisite Software
- Resources
- Install Eclipse
- Install the Eclipse Plugins for Web Application Development
- Configuring Eclipse for Web Development
- Configuring the Workspace for Web Development
- Create a New Web Development Project
- Create a Basic JSP
- Web Archive – How to create a war file from Eclipse
- Overview
- Create a New Project
- Configuring your Project to reference the BOE SDK
- Allowing Tomcat to Compile JSPs that use the BOE SDK
- Creating a Simple BOE Logon Application
- Packaging the Application in a WAR file
- Integrating Java Doc for the BOE SDK
Part One
Part Two
Prerequisite Software
Eclipse is available in various packages depending on your development requirements. We can either use the Eclipse for Enterprise Java which includes the web development tools or we use the basic Eclipse for Java and then add on the web development tools. See the Compare Packages page for a summary of the differences between the versions.
Eclipse for Enterprise Java when installed is already setup for web development however it contains more features than we need to BOE web development. The instructions below use the basic Eclipse for Java and then step through adding on the required web development tools. If you are using Eclipse for Enterprise Java then you can skip down to the section “Configuring the Workspace for Web Development”.
All Eclipse products can all be downloaded from links on the download page.
Either download the Eclipse IDE for Java EE Developers or download the basic Eclipse IDE Eclipse Galileo (Eclipse classic 3.5.1) and then download the Web Tools Platform project and it’s prerequisites: EMF v2.5 Runtime, EMF XSD v2.5 Runtime and Graphical Editing Framework (GEF).
In addition to Eclipse you will also need a Java Development Kit – JDK 1.5 or above – which you can download from Sun and Apache Tomcat 5.5 or above which you can download from the Apache web site.
Resources
For further information on Eclipse refer to their online documentation especially the getting started section.
If you want to learn Java Web Technology then there is detailed online course at gulland.com.
For reference materials on BusinessObjects SDK go to the SAP Support.
You may also wish to check out an online tutorial on using the Eclipse Web Tools Platform with Apache Tomcat.
Install Eclipse
Eclipse is downloaded as a ZIP package. It doesn’t require installation and so you just unzip the package to a suitable folder – I use C:\Eclipse but you could also use C:\Program Files\Eclipse
Once unzipped you can launch Eclipse by running the file eclipse.exe. You probably want to create a shortcut to this executable on your desktop or in your start menu.
When you first launch eclipse it will as you to create a workspace. You can either accept the default however I prefer to create mine in a more accessible location. This workspace folder will contain all your work – the source code and the build packages.
For the remaining steps described below I’ll be using the following as the Eclipse installation folder,
C:\Eclipse\eclipse-java-galileo-win32
Install the Eclipse Plugins for Web Application Development
Now that we’ve installed eclipse we need to install the web development plugins from the Web Tools Package.
- Shutdown Eclipse if it is currently running
- Copy the ZIP files that you have downloaded to the Eclipse ‘dropins’ folder which is found at,
- Unzip each file to the current folder so that you have the following subfolders of the dropins folder,
- Now start up Eclipse and the plugins will be installed automatically.
- To check that they have been successfully installed select ‘About Eclipse’ from the Help menu and in the dialog you’ll see 5 icons.
- When you first launch Eclipse for the first time your view is of the welcome screen, select the icon to go to the workbench and we are now ready to configure eclipse for web development.
C:\Eclipse\eclipse-java-galileo-win32\eclipse\dropins
emf-runtime-2.5.0 GEF-SDK-3.5.1 wtp-R-3.1.1-20090917225226 xsd-runtime-2.5.0
These icons represent the different features installed in Eclipse and the ‘wtp’ icon is for the Web Tools Project. Clicking this will display details of the version and features available in the Web Tools Project.
Configuring Eclipse for Web Development
If you already have a project under development in eclipse then we need to create a new workspace that we can configure for web development. If however you have just installed Eclipse then you already have a new workspace and so we can go ahead and configure that one.
Create a New Workspace
If you need to create a new workspace then follow these steps otherwise skip to the next section.
- From the File menu select New Workspace
- Create a workspace folder in your preferred location
We can now configure this workspace for web development. Note, when you next launch eclipse you’ll be asked to select a workspace and so select this one. You may wish then to give it a name that refers to the project.
Configuring the Workspace for Web Development
The first thing we do is to define Tomcat as the web application server,
- Change the perspective to web development if not already (Eclipse for Enterprise Java may default to this): Window > Open Perspective > Other and then select Java EE from the list.
- Next select Windows > Preferences and then in the list of items on the right select expand Server and select Runtime Environments.
- In the panel on the right click Add to add a new Tomcat server.
- Select Apache Tomcat v5.5 and click Next
- Enter path to Tomcat installation. Select the folder that contains the sub folders ‘bin’, ‘conf’ etc, for example C:\Tomcat\apache-tomcat-5.5.26
- In the same dialog we need to specify the JDK that Tomcat will use to compile JSPs etc. To do this click on Installed JREs
- In the next dialog click Add
- Select Standard VM for JRE Type and click Next
- Click Directory and select the JDK folder: C:\Program Files\Java\jdk1.5.0_11. Eclipse will now add the libraries for the JVM
- Click Finish to return to the JRE dialog
- Here select the checkbox next to the JDK you’ve just added. It should look something like the following
- Click OK to close that dialog
- Click Finish to adding new Tomcat server
- And finally OK to return to the Eclipse workbench.
Eclipse is now configured to use Tomcat as a web application server. When testing your web app you may wish to manually start and stop Tomcat yourself. To do this we need to open the server view, - From the Window menu select Show View > Servers. The Servers dialog will open in the workbench, you can move it around, I prefer to have mine in the same panel as the project explorer.
Create a New Web Development Project
OK now we’ve setup Eclipse we can start a new project
- Create a new Dynamic Web Project by right-clicking in the empty white space of the Package Explorer pane at the extreme left of the workbench, choosing New > Dynamic Web Project.
- Give it a name such as ‘boe’
- No further settings is required so just click finish.
Create a Basic JSP
OK we can now create a simple JSP and then check that everything is working as expected.
- Right click over the white space area in the project explorer and select New > JSP (you can also right click over any of the folders – Eclipse will always know to put new JSPs in the correct Web Content folder).
- Enter a name for the JSP ‘simple’ and click Next. Note, when requesting a JSP page via a URL the name is case sensitive so it is a good idea not to mix case in JSP file names if possible.
- Select any template – default is fine for our needs. Note, you can create your own JSP templates in Eclipse that can contain a default page layout or reference corporate CSS files.
- You should now have a screen similar to the one below and we can now write some JSP code.
- Enter the following code between the ‘body’ tags,
- Save the JSP file by clicking the save icon or CTRL+s or from File > Save menu
- Run the project by clicking the Run icon or from the Run menu select Run.
- Accept to run using the default Tomcat server and your JSP should display in the browser
- Now go back to the JSP editor and add the following directive at the top of the page,
- Next update the code within the body tags to look like the following,
- Save the JSP and go back to the eclipse browser tab and click the refresh icon. The JSP should now update with the change.
This page was last viewed <%= session.getLastAccessedTime() %>
Now we want to test the JSP page. To do this we run the app which will startup Tomcat, launch the Eclipse browser and then display the JSP. Note, by default Eclipse will use it’s internal browser however you can configure eclipse to use another browser installed on your worklstation. Goto Window > Preferences and then expand General and select Web Browser.
<%@ page import="java.util.*" %>
<% Date d = new Date(session.getLastAccessedTime()); %> This page was last viewed <%= d.toString() %>
Web Archive – How to create a war file from Eclipse
When we have finished with a project and want to deploy it elsewhere we create a WAR file. To do this,
- Right click on the project and select Export > WAR file
- Update the name or keep default and enter a Destination for where the WAR file will be created
- Click Finish and your WAR file is generated.
You can now import the War file to your test or production environments. Refer to your application server documentation for instructions on how to deploy a web application from a WAR file.
That gets us started with creating web applications. In the next article we’ll look at how to setup Eclipse to use the BusinessObjects SDK and then create a simple logon page to test that all is set up correctly.







7 Responses to “Part 1. Getting Started with Web Development using Eclipse”
i did all these things and followed part 2 too but getting following error
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: com/crystaldecisions/enterprise/ocaframework/idl/ImplServ/OSCAFactoryPackage/connection_failure
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
javax.servlet.ServletException: com/crystaldecisions/enterprise/ocaframework/idl/ImplServ/OSCAFactoryPackage/connection_failure
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.login_jsp._jspService(login_jsp.java:85)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet
By broccolimustdie on Jul 9, 2010
that seems to be a fairly generic error, do you know at what point in your code is throwing the error?
By agulland on Jul 10, 2010
it was just some jars missing so i included whole library…. thanks for great post
By broccolimustdie on Jul 14, 2010
agulland,
I am new to SDK and after successfully pulling report i have requirement to show prompts of that report to user using SDK…. I have downloaded sdkexample and trying to figure out things from it but as i am not programmer i have great deal of problem understanding the way there are 5-6 jsp files and all….. is there any easy to understand document which can help me Thanks in advance
By broccolimustdie on Jul 15, 2010
Samples are your best bet although they aren’t easiest for deciphering what’s going on. There’s a few more docs on the SAP website but they aren’t very detailed. If you don’t have experience of java and JSP it will be difficult to begin with. What might help is to start with what you have for viewing a doc and then add code for prompts, testing as you go to see how it fits together.
The tricky thing with prompts is that you need to display a page that allows a user to fill in prompt values and then take those to another page which displays the doc.
Good luck!
AL
By agulland on Jul 16, 2010
And I should’ve said if you’re looking at learning JSP then a good place to start would be my JSP course!
By agulland on Jul 18, 2010
Good one.. i liked the step by step process properly documented..
Thank You Very Much
By Naren on Sep 2, 2010