The NetBeans IDE is a development environment - a tool for programmers to write, compile, debug and deploy programs. It is written in Java - but can support any programming language. It is a free product with no restrictions on how it can be used.
You can download the IDE from either the Sun website or the NetBeans website. My preferred approach is to download the Java/NetBeans co-bundle so I will not have to worry about configuring my Java development environment.
When you download the NetBeans IDE, you get a development tool for writing Java programs. There are plug-in modules available that support other languages and technologies, from C and C++ to XML, HTML and Java Server Pages, to almost any technology you can think of. Some of its features are:
- Syntax highlighting code editor - with support for code completion, annotations, macros and auto-indentation, capable of mixed-mode operation for multi-language documents.
- Support for the Java, C, C++, XML and HTML languages.
- Support for JSP, XML, RMI, CORBA, JINI, JDBC and Servlet technologies - integrated support to make it easier write code that uses these technologies.
- Support for Ant, CVS and other version control systems - Version control systems integrate smoothly and easily into the IDE.
- Pluggable support for compilers, debuggers and execution services - Execution, compilation, debugging and deployment are not tied to a specific Java Virtual Machine, as with other IDE's.
- Visual design tools for graphically creating and manipulating visual components.
- Wizards and code generation and management tools for creating code faster and more easily.
- Cross-platform - since the IDE is written entirely in the Java language, it will run on a huge number of operating systems
When you start NetBeans for the first time, you should see a welcome screen similar to this:

Click here to enlarge
To start developing for CRN with the NetBeans IDE, you should first define a project.
Click Project – Project Manager

Click here to enlarge
From the following menu click the new button

Click here to enlarge
We will create a login page to CRN so let's call our project “Login to CRN project” 
A new project will be created with no file systems mounted.

Click here to enlarge
A single project can have multiple file systems mounted. Also any JAR files that we will add to the project will be mounted in a way similar to a file system. A file system in it's simplest form is a directory local to the developer's machine.
Let's create a new folder on your local hard drive called C:\Development\CRN\Logon Page

Click here to enlarge
Now, let's go back to NetBeans IDE and mount a new file system. Click File and select Mount Filesystem.

Click here to enlarge
Select Local directory and click Next

Click here to enlarge
In the following window navigate to C:\Development\CRN, select Logon Page and click Finish.

Click here to enlarge
Your new file system should be now mounted.
Right click on the file system and select New – Web Module

Click here to enlarge
If Web Module is not available in the list, select All Templates, expand JSPs & Servlets node, and select the Web Module from the list.

Click here to enlarge
Regardless of the method used, click Finish in the next window. You might be warned that a separate view of the web module has been created. Click OK.
At this time you might want to click on the middle tab to switch to a project view of your application.

Click here to enlarge
At minimum you need to add the following files to the lib directory of your application:
- axis.jar
- axisReportNetClient.jar
- commons-discovery.jar
- commons-logging.jar
- jaxrpc.jar
- saaj.jar
- xercesImpl.jar
- xml-apis.jar
You can find all these files in the CRN folder \webapps\p2pd\WEB-INF\lib. Use your favorite method to copy those files to the lib folder of your application. After copy is complete right-click the lib folder in NetBeans IDE and select Refresh Folder. We are now ready to create the login page to your application.

Click here to enlarge
Right-click the Document Base node and select: New – JSP. If JSP is not available, click All Templates and select JSP from JPSs & Servlets node.
Type logon and click Finish
The IDE will open the source code for the page in the right pane. Type the following code into the editor (comments, lines begining with //, are optional):
<%@ page language="java" session="true" isThreadSafe="true" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.cognos.*"%>
<%
//set the character encoding to UTF-8 prior to accessing
//data in the request
request.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>ver0.2 Sign In - Cognos ReportNet</title>
<META http-equiv="Content-Type" content="text/xml; charset=UTF-8">
<TITLE>Sign In - Cognos ReportNet</TITLE>
<LINK type="text/css" rel="stylesheet" href="sdk.css">
<META name="Copyright" content="Copyright (C) 2002 Cognos Incorporated.">
<META name="Trademark" content="Cognos and the Cognos logo are trademarks of Cognos Incorporated.">
<script>
function login() {
document.signIn.submit();
}
</script>
</head>
<%
// Retreive the available namespaces we can login against
CMInterface cm = new CMInterface( "http://localhost/crn/cgi-bin/cognos.cgi", application, session );
String[] namespaces = cm.getNamespaces();
boolean bError = false;
try {
// This try block will fail when no namespaces have been found, the catch block
// will redirect to the target page, bypassing the login because anonymous
// access is allowed
// ... and build a drop down's option list with them.
String options = "";
for (int i=0; i<namespaces.length; i++)
options += "<option>" + namespaces[i] + "</option>";
// Determine what to do, either show the login
// form or proceed with the login
String action = request.getParameter("action");
// Once the login has been performed, the flow continue with the
// page we were at before the login page was shown
if ( action == null || action.equals("") ) {
// When comming in for the first time we cache in the session scope memory the referrer
// so we can redirect the user after authentication is sucessfull
%>
<body topmargin="3" bottommargin="0" marginheight="3" rightmargin="3" leftmargin="3" marginwidth="3">
<form name="signIn" method="post">
<input type="hidden" name="action" value="login">
<!--header -->
<TABLE border="0" cellpadding="0" cellspacing="0" height="21" width="100%">
<TR>
<TD class="dialogHeaderTitle" valign="middle" height="20"><IMG border="0" width="2" height="10" alt="" src="space.gif">Logon</TD>
<TD valign="middle" align="right" height="20"><TABLE border="0" cellpadding="0" cellspacing="0" height="20">
<TR>
<TD colspan="3" class="dialogHeaderBorder" height="1"><IMG width="1" height="1" src="space.gif"></TD>
</TR>
<TR>
<TD class="dialogHeaderBorder" height="19" width="1"><IMG width="1" height="1" src="space.gif"></TD>
<TD height="19" width="19"><A href="javascript:"><IMG border="0" vspace="2" hspace="2" width="15" height="15" src="close.gif"></A></TD>
<TD class="dialogHeaderBorder" height="19" width="1"><IMG width="1" height="1" src="space.gif"></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD class="dialogHeaderBorder" width="100%" height="1" colspan="2"><IMG width="1" height="1" src="space.gif"></TD>
</TR>
</TABLE>
<TABLE cellspacing="0" cellpadding="0" border="0" width="100%">
<TR>
<TD class="dialogHeaderText" height="20">Enter a user ID and password that is valid for Cognos applications and select the namespace to use for logging on.</TD>
<TD><TABLE align="right" height="20">
<TD nowrap="nowrap" class="dialogHeaderLink" valign="top"><A href="javascript:"><!--Help--></A></TD>
</TABLE></TD>
</TR>
</TABLE>
<!-- dialog contents -->
<table border=0>
<tr><td valign="top">
<table>
<tr><td class="formLabel">User ID:</td></tr>
<tr><td class="formLabel"><input type="text" name="signInUserID" value="anonymous" size="50"></td></tr>
<tr><td height="10"><IMG width="1" height="10" src="space.gif"></td></tr>
<tr><td class="formLabel">Password:</td></tr>
<tr><td class="formLabel"><input type="password" name="signInPassword" value="" size="50"></td></tr>
<tr><td height="10"><IMG width="1" height="10" src="space.gif"></td></tr>
<tr><td class="formLabel">Namespace:</td></tr>
<tr><td class="formLabel"><select name="signInNamespace"><%=options%></select></td></tr>
</table>
</td></tr>
</table>
<BR>
<!-- bottom bar -->
<TABLE width="100%" cellspacing="0" cellpadding="0" height="1" border="0">
<TR>
<TD class="dialogFooterBorder" height="1" width="100%"><IMG width="1" height="1" src="space.gif"></TD>
</TR>
</TABLE><BR>
<TABLE cellspacing="0" cellpadding="1" border="0">
<TR>
<TD height="20" width="65" class="commandButtonBorder"><TABLE bgcolor="FFFFFF" height="18" width="65" cellspacing="0" cellpadding="0" border="0">
<TR>
<TD nowrap="nowrap" align="center" valign="top" class="commandButtonActive"><A class="commandButton" href="javascript:login()">Log On</A></TD>
</TR></TABLE>
</TD>
<TD height="20" width="5"><IMG width="5" height="1" src="space.gif"></TD>
<TD height="20" width="65" class="commandButtonBorder"><TABLE bgcolor="FFFFFF" height="18" width="65" cellspacing="0" cellpadding="0" border="0">
<TR>
<TD nowrap="nowrap" align="center" valign="top" class="commandButtonActive"><A class="commandButton" href="javascript:">Cancel</A></TD>
</TR></TABLE>
</TD>
</TR>
</TABLE>
</form>
</body>
<%
}
else
{
// Store the login information in the user's session so they
// can be used to authenticate the user.
session.setAttribute("namespace", request.getParameter("signInNamespace"));
session.setAttribute("uid", request.getParameter("signInUserID"));
session.setAttribute("pwd", request.getParameter("signInPassword"));
//now, test to see if the login worked
if(cm.testLogin())
bError = false;
else
bError = true;
// go back to where we were
if(bError)
{
response.sendRedirect("logon.jsp?error=1");
}
else
response.sendRedirect("loggedIn.jsp");
}
} catch ( Exception e ) {
// A sendRedirect call does not exit the current request, it finishes it
// and the redirection appends once this one is done.
// if the namespace list is null, then anonymous is enabled
// set the credentials in the session so the redirect to this page is
// skiped.
//session.setAttribute("namespace", "");
//session.setAttribute("uid", "anonymous");
//session.setAttribute("pwd", "");
if(bError)
response.sendRedirect("logon.jsp?error=1");
else
{
if (namespaces == null)
response.sendRedirect("anonymousOn.jsp");
}
}
%>
</html>
Using the same method create these two additional JSP files:
anonymousOn.jsp
<%@page contentType="text/html"%>
<html>
<head><title>JSP Page</title></head>
<body>
<H1>Anoymous access is enabled</H1>
<H2>Please disable and try again</H2>
</body>
</html>
loggedIn.jsp
<%@page contentType="text/html"%>
<html>
<head><title>JSP Page</title></head>
<body>
<H1>Login successful</H1>
</body>
</html>
To complete the application we will also need the sdk.css file and two GIF files: space.gif and close.gif. Find them in the CRN folders and copy to root folder of your application. Refresh the Document Base directory in the IDE after the files are copied.
Next, right click on the Classes folder and select New – Java Package. Call it com. Using the same method create another package called cognos in the com package. To speed up development process, in CRN folders find files called CMInterface.java and Helper.java, and copy them to the C:\Development\CRN\Login Page\WEB-INF\classes\com\cognos. Refresh the Classes-com-cognos folder in the IDE. Double click the CMInterface file and change the sixth line to read package com.cognos; (remove the .jspSample). Repeat the same for the Helper file. Click the top node and select Build All

Click here to enlarge
You should be now able to right-click the logon page and select Execute. This should bring you to the logon page, unless anonymous access is enabled. If so, disable Anonymous access, restart the CRN server and try again.
I hope this will help you get started with your first custom application for Cognos ReportNet.
Darek Danielewski
BrightStar Partners, Inc.
ddanielewski@brightstarpartners.com