30 Developing JSPs with Developer Tools

You can develop WebCenter Sites JSPs using the native Eclipse JSP editor using Developer Tools kit. Eclipse uses tag libraries and JAR files of your the current WebCenter Sites instance, and it also supports WebCenter Sites style of syntax highlighting and debugging.

Topics:

30.1 JSP Development with Developer Tools

Developing WebCenter Sites JSPs using the native Eclipse JSP editor is a convenient and productive experience. This is because the Eclipse JSP editor includes support for WebCenter Sites tag and Java API completion, syntax highlighting, and debugging.

The following figure shows an example of a WebCenter Sites JSP in the Eclipse editor:

Figure 30-1 Eclipse JSP Editor

Description of Figure 30-1 follows
Description of "Figure 30-1 Eclipse JSP Editor"

WebCenter Sites JSPs can include page caching, resultset caching, and associated metadata such as Template assets, CSElement assets, or ElementCatalog entries. The metadata of a JSP enables WebCenter Sites to track and manage it. Developer Tools handles a JSP's underlying WebCenter Sites processes transparently, including tracking the JSP and its corresponding metadata. If your WebCenter Site instance is running, and you save a JSP in Eclipse, the Developer Tools kit automatically synchronizes those changes with the WebCenter Sites instance. Any metadata associated with the JSP is also synchronized with WebCenter Sites. This enables you to view the changes in WebCenter Sites as soon as you save the JSP in Eclipse.

30.2 Tag and Java API Completion

In Eclipse you find tag and Java API completion features. Eclipse uses the tag libraries and JAR files of the current WebCenter Sites instance to provide the appropriate code completion for WebCenter Sites related tags and Java APIs.

For local hosts, the WebCenter Sites tag libraries and JAR files are automatically linked to your Eclipse project, and contained within the Eclipse project folder (located in the Project Explorer view). For remote hosts, the WebCenter Sites tag libraries and JAR files must be manually copied from the remote host to your Eclipse project. See Setting Up Developer Tools.

  • The tag libraries are contained in the futuretense_cs folder under the WEB-INF folder.

  • The JAR files are contained in the WEB-INF/lib folder.

    Note:

    When you use the tag and Java API completion feature, keep in mind the following:

    • Make sure you follow strict JSP coding standards so that your code can be deployed on any application server.

    • Eclipse code completion shows all public Java methods contained within the WebCenter Sites JARs. Only use the APIs described in the WebCenter Sites documentation. Using undocumented functionality is risky and unsupported.

In Eclipse, the tag and Java API completion features display information about each tag and piece of Java code you use when managing a WebCenter Sites JSP. For example, when you are working with a WebCenter Sites JSP and you begin to type the name of a tag, a window opens listing code completion suggestions. Then, a second dialog opens containing information about each suggestion.

Figure 30-2 Tag and Java API Completion Feature

Description of Figure 30-2 follows
Description of "Figure 30-2 Tag and Java API Completion Feature"

In addition to the code completion feature, the Javadoc, Visitor Services API, and Tag Reference are made accessible in the Sites Developer Reference view. See Sites Developer Reference View.

30.3 Debugging

If you would like to debug Java and JSP code in Developer Tools, you should first attach the debugger to the JVM process that runs WebCenter Sites. We recommend this especially when you plan to do remote debugging.

To attach the WebCenter Sites JVM, follow the instructions provided by Eclipse at the following URL:

http://www.ibm.com/developerworks/library/os-ecbug/

After the JVM is attached to the debugger, you can set breakpoints in your JSP and Java code, view variables, and so on.