JTSL and ADF problem with complex types
I’m working on what should be a simple ADF and JSTL application, but somehow i can’t get it to work. I’ve got two javabeans, employee and address. The employee class contains it’s number, firstname and lastname and also the employee’s address.
I want to create a jsp page with a table which lists all the employees and their addresses. So every row of the table will have a column employee number, first name, last name, and columns city, zipcode, etc.
I’ve created data controls for the javabeans, so they show up in the data control palette. Next i’ve dragged and dropped the employee data control onto the jsp page as a read only table. When you do this only the simle attributes of employee are displayed in the table: employee number, firstname and lastname. The address attributes aren’t added to the table.
I’ve you look in the jsp source code, there are jstl tags to get the values for the employee columns, e.g., ${Row.firstName}, ${Row.employeeNumber}, etc.
According to the jstl syntax, if you have a javabean employee containing a javabean address, you should be able to access it in your jsp with the following syntax: ${Row.address.city}. (The Row variable is specified by the forEach tag.) This doesn’t work though. Nothing is displayed. I’ve also tried ${Row[address.city]} and ${Row[address].city}, but nothing works.
When you create a data control for a javabean, jdeveloper creates an xml file which describes the javabean. For normal attributes it contains a tag Attribute which describes the attribute. For the address attribute it creates a AccessorAttribute tag. I’ve replaced the AccessorAttribute by an Attribute tag for address, now getting the city works with the following jstl: ${Row.address.city}. The weird thing is, you’re not supposed to change the xml file describing your javabean. The file is non-editable in jdeveloper. Instead you have to edit outside of jdeveloper.
All in all this looks like a bug in adf, i’ve posted a question on the OTN jdeveloper forum, but no replies so far.
April 1st, 2006 at 9:46 am
Hi,
I am suprised to see the date of your article, because this seems still to be the problem in ADF Faces operating on both ejb 3, toplink or business components.
Did you ever get some feedback from otn jdeveloper forum !