Showing posts with label array. Show all posts
Showing posts with label array. Show all posts

Friday, March 9, 2012

ADF: Creating and Using an ADF Declarative Component

This tutorial shows you how to create ADF declarative component metadata, add ADF Faces components that make up the composite component, and use the declarative component on a JSF page.

In this post ADF: About JSF fragments, ADF regions, declarative components …, i wrote about different declarative component in ADF faces.

You will use wizards to quickly create applications and projects, and a declarative component definition consisting of an attribute, a facet and a method.

The declarative component you will create is panel box containing one label, list of input text, and button. The metadata for the declarative component definition will allow page authors to set the label for a panel box, attach a method to the button to print the input lists after modification, and use built in controllerContext to view page viewId as default value.

To create the declarative component layout, you will use design tools such as the visual editor, Component Palette, and the Property Inspector. Then you will deploy the project to an ADF Library JAR file. For an application to consume the declarative component, you will use the Resource Palette to add the deployed JAR, and then add the deployed JAR to the project that contains JSF pages.

To make use of the declarative component, you will add it to a simple JSF page, edit the pre-defined attributes, create a method and attach it to the declarative component. When you run the application, the page will look similar to this:



Friday, March 2, 2012

Glassfish 3.1.2: Unable to load resource [com.mysql.jdbc.EscapeProcessor]

While I am building JEE6 web profile application, using EJB3.1, JPA2.1, JSF (IceFaces 3) against MySQL database v5.1.15, my java web app fails in Netbeans v7.1 when I try to run it.

Netbeans reports successful deployment, but then I get this error when executing a JPA query against MySQL:

java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [com.mysql.jdbc.EscapeProcessor], because it has not yet been started, or was already stopped.
This error occurs at the first query against the database. The entire application works fine with Netbeans version 7.1.
One potential clue is that I had to manually add the MySQL driver to the project for unit test the project using embedded glassfish 3.1.2.

After reviewing/tracing the problem and some googling about the problem here is the fix:

  1. For unit testing put the MySQL driver in the test libraries only don't add it to the project to final deployment.
  2. For production, the MySQL driver should not be in the project ... it should be in <DOMAIN>/lib/ext... in your glassfish v3.1.2 folder.
If there is any help just leave your comment.

Wednesday, May 25, 2011

ADF: Defining an attribute-class for an array of objects in ADF template

When defining the attributes for an ADF Faces af:pageTemplate or af:declarativeComponent inside of an af:xmlContent, you need to provide an attribute-class definition. This looks something like:

but what if you needed an array of Strings? That has a bit stranger syntax:

Why is this not just "java.lang.String[]"? These attribute-class entries are the result of calling Class.forName.

 The Class.forName on an array of objects looks like "[[Lsome.package.SomeClass;".