I second the notion that we should allow a null object/property.  In the
"write" tag, there is an ignore parameter that can be specified which allows
a null object as a return value from RequestUtils.lookup().  The problem is
in RequestUtils, when it encounters a problem finding the named object, or
one of the chain of dot-notated properties, it throws a JspException rather
than just returning a null value.  To me, I think the "ignore" parameter
should be carried over to RequestUtils so that the user can specify if a
null value is a valid value or if it should throw the JspException.  I also
believe the "ignore" concept should be added to the BaseFieldTag so the HTML
tags extending it could also specify if a null value was valid.  Any
thoughs?

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 6:42 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: question about BaseFieldTag and dotted path properties


Hello,

i am using the html hidden tag as follows <html:hidden name="model"
property="actualAddress.primaryKeyString"/>.

The bean model is available and has the function
public Address getActualAddress();

and Address has the function
public String getPrimaryKeyString();

If the getter method of the bean model returns null (getActualAddress())
then we receive the following error message.

java.lang.IllegalArgumentException: Null property value for 'actualAddress'
        at
org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.java:41
7)
        at org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:453)
        at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:503)
        at
org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:188)
        at
_jsp._vsdev._businesspartner._test__jsp._jspService(/vsdev/businesspartner/t
est.jsp:23)
        at com.caucho.jsp.JavaPage.service(JavaPage.java:87)
        at com.caucho.jsp.JavaPage.subservice(JavaPage.java:81)
        at com.caucho.jsp.Page.service(Page.java:407)
        at com.caucho.server.http.Invocation.service(Invocation.java:285)
        at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:121)
        at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:238)
        at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:157)
        at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
        at java.lang.Thread.run(Thread.java:484)

In my opinion the html:hidden field should render null value, like a call
without dotted path and null value.

What is your opinion ?

Should we catch the exception in RequestUtils ? or in each Tag ?

I can fix it if you will tell me how i should do it.


Thanks

Markus




Reply via email to