Added prefixes as appropriate to the content of this email. On 10/12/05, James Carman <[EMAIL PROTECTED]> wrote: > Danny, > > Sorry. I thought you were trying to access a public property of a package > private class from a reference to an instance of that package private class. > This does appear to be a bug. <snip/>
There's more to this than the JLS. EL relies on the JavaBeans spec for Introspection. Danny - I'd recommend reading the chapter on EL from the JSP 2.0 spec (I believe its Chapter 2) and the chapter on Introspection from the JavaBeans spec (I believe its Chapter 8). You could coax the Instrospector by making your abstract base class public, or strong-arm it by supplying the appropriate BeanInfo class. > What's quite troubling, though, is that there > are absolutely NO test cases in SVN for commons-el! Am I missing something? <snap/> James - That probably has to do with its origins. Commons EL, I would think, has its origins in an RI of the JSP spec (until JSP 2.0, the EL "spec" was part of the JSP spec). > Is there no way to test this stuff outside of a Servlet/JSP container? <snip/> You could use the Commons SCXML environment packages. To test an expression language implementation, one minimally needs a context of evaluation and an evaluator. Since we use SCXML in the JSP environment, the Commons SCXML implementation provides an API that can be easier for standalone EL testing (without the need for a servlet container). In this case, you could test as follows: <incomplete-code-snippet> //imports come from SCXML env packages Context context = new ELContext(); // get an instance 'bar' of type Bar as desired context.set("bar", bar); Evaluator evaluator = new ELEvaluator(); String firstName = (String) evaluator.eval(context, "${bar.firstName}"); // above line will need a try block </incomplete-code-snippet> -Rahul > > James > > > -----Original Message----- > From: Trieu, Danny [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 12, 2005 12:14 PM > To: Jakarta Commons Developers List > Cc: [EMAIL PROTECTED]; Destiny Developers > Subject: RE: Posible bug with commons EL..... > > James, > > Thanks for your response. But I don't think I did make the case clear > enough. So, let me give it another try. > > My beans are in package com.xxx.domain > > com.xxx.domain > > abstract class Foo { // Notice: this class has the default package access > //modifier. > private String firstName ; > private String lastName ; > ...... Public Getters/Setters .... > } > > Now child class in the same package com.xxx.domain > > com.xxx.domain > > public class Bar extends Foo { // Notice: this class has "public" access > modifier > private String abc ; > ...... Public Getter/Setter .... > } > > Out side of com.xxx.domain package, I have no problem creating Bar and at > The same time accessing Foo's, Bar's parent, properties. > > For Example: > > Public class BarActionForm extends ActionForm { > Private Bar bar ; > ...... Public Getter/Setter ..... > } > > public class BarAction extends Action { > public ActionForward execute( ...., ActionForm form, .... ) { > Final BarActionForm barForm = (BarActionForm) form ; > > barForm.getBar().setFirstName( "myFirstName" ) ; // no > problem > // accessing Bar's parent properties. > > return mapping.findForward("success") ; > } > } > > You see, I have no problem access Foo's properties from a Bar instance > inside my BarActionForm instance. > > However, the problem is inside my JSP, where I have the BarActionForm binded > To an action mapping of my html's form tag. Accessing Foo's properties with > EL will result with IllegalAccessException. You see, this is clearly a bug > in commons-el. > > For example in my JSP: > > ...... > <html:form action="/myActionMappingPath" > <!-- this mapping has "myForm", > BarActionForm, bind to it --> > .... > <html:text property="bar.firstName" /> <!-- this is where I had the > IllegalAccessException --> > .... > </html:form> > > I hope this would make it clear that this is a bug. I've search the commons > archive and nothing that I found related to this issue. > > Thanks for any help, > > --danny <snap/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]