Skip to main content

NetBeans - Take 2 and Call Me in the Morning

Posted by bleonard on September 29, 2005 at 6:36 PM PDT

I came across this post from a frustrated developer today, and couldn't help but wonder - are we keeping NetBeans a secret? Poor Dan is just trying to create a simple JSP. For some reason, I couldn't see the code referenced in his post, but I think I got the gist of what he's trying to do. Let's tackle them one frustration at a time:

Frustration #1 - Create a Hello World Web Project

  1. Create a new Web Application named HelloWorld (File > New Project > Web > Web Application).
  2. Change the text in index.jsp from "JSP Page" to "Hello World!".
  3. Press F6.

Frustration #2 - Closing and Opening a Project

  1. Choose File > Close "HelloWorld"
  2. Choose File > Open Recent Project > HelloWorld

Frustration #3 - Working with JSTL

Here's where I couldn't see Dan's code. However, it looks like he's just trying to display some results from a table. For the purposes of this example, I'm just going to use the Pointbase database and sample data that comes with the J2EE 1.4 SDK. If you already have a different database set up, just change the settings to match your configuration.

  1. Add the Pointbase JDBC driver to the project (Properties > Libraries > Add JAR/Folder). It's in pbembedded.jar, which you'll find in the J2EE SDK's pointbase/lib directory. For me it's at C:\Sun\Appserver\pointbase\lib\pbembedded.jar.
  2. Add the JSTL library to the project (Properties > Libraries > Add Library)
  3. Uncomment the <%@taglib uri="" prefix="c"%> line in index.jsp
  4. Add the line <%@taglib uri="" prefix="sql"%>
  5. Add the following between the tags:
<h1>Customer List</h1>

<sql:query var="customerQuery" dataSource="${customerDS}">

<TABLE border=1>
         <TD>Customer Num</TD>
         <TD>Customer Name</TD>
         <TD>Customer City</TD>
         <TD>Customer Phone</TD>
     <c:forEach var="row" items="${customerQuery.rows}">
             <TD><c:out value='${row.CUSTOMER_NUM}'/></TD>
             <TD><c:out value='${row.NAME}'/></TD>
             <TD><c:out value='${row.CITY}'/></TD>
             <TD><c:out value='${row.PHONE}'/></TD>
  1. Press Ctrl+Shift+F to reformat the code.
  2. Start Pointbase (Tools > Pointbase Database > Start Local Pointbase Database). Note, you need to have the J2EE 1.4 SDK added as a server to see this option (Tools > Server Manager > Add Server)
  3. Press F6.


Headache cured.

Related Topics >>