Alright! I've made progress. :) 

I must have started with a cobbled-up version of the improvements Rick 
Reumann made to the Display Tags, because (in the archives) he made it 
sounds so easy! Thank you, Rick, for giving me something to start with 
anyway. This is how I got it to work for me:

My jsp now looks like ...

  <display:table name="myForm" property="myObjectArrayToDisplay" 
columnsToDisplay="columns" scope="request" >

where "columns" is a field of type String[] on myForm, with getters and 
setters, and populated in my action prior to displaying the jsp.

I changed the lookup() parameters in the TableTag to ... 

 public int doStartTag() throws JspException {

  Object obj = null;
   if (this.columnsToDisplay != null) {
     obj = (String[]) lookup(this.pageContext,
                                this.name,
                        this.columnsToDisplay, this.scope, false);
   }
   if (obj != null) {
     this.columnsDisplayArray = (String[]) obj;
   }

  HttpServletRequest req = (HttpServletRequest)this.pageContext.getRequest();

  this.loadDefaultProperties();

<snip>
 
}

All *seems to be* working, and just in time for the weekend.

Hope this might help someone else.

Susan Bradeen

On 03/28/2003 02:31:53 PM "Susan Bradeen" wrote:

> I have been using the Display tag for quite a while, but now I am trying
> to implement the "dynamic columns" feature, meaning passing an array of
> column names so the <display:table> shows only those columns. Does 
anyone
> else have this working?
> 
> The Display TableTag is using the
> org.apache.taglibs.display.TableTag.lookup() method, which keeps 
throwing
> a null pointer exception. Using System.out statements, I know that the
> lookup() is not getting nulls for pageContext, columnsToDisplay, 
property,
> and scope. And putting the lookup() in a try/catch block picks up the
> thrown exception. Although I am passing values/objects to lookup(), I am
> wondering if I am passing the *right* values/objects? I think (hope) it
> will work, if I can just get past this.
> 
> My jsp contains (in part) ...
> 
> <bean:define id="columnArray">
> <bean:write name="myForm" property="columns"/>
> </bean:define>
> 
> <display:table name="myForm" property="myObjectArrayToDisplay"
> columnsToDisplay="<%= columnArray %>" scope="request" >
> 
> The TableTag source code contains the following (in part)  ...
> 
> public int doStartTag() throws JspException {
> 
> Object obj = null;
> if (this.columnsToDisplay != null) {
> obj = (String[]) lookup(this.pageContext,
> this.columnsToDisplay,
> this.property, this.scope, false);
> }
> if (obj != null) {
> this.columnsDisplayArray = (String[]) obj;
> }
> 
> HttpServletRequest req = 
(HttpServletRequest)this.pageContext.getRequest();
> 
> this.loadDefaultProperties();
> 
> <snip>
> 
> }
> 
> Can anyone shed some light on this?
> 
> Susan Bradeen
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to