well, now that I look at it, I would expect this to fail. Again, look at
where you are putting this code: at the class level. The String array
filelist is being created at object instantiation time. The contextualize
function is almost certainly not being called until *after* the filelist
variable is created and initialized. Are you very familiar with java?
Looking at the generated source code should help you with this kind of
problem.
Instead of creating a variable to hold on to your file list, why not
instead create a function that you can then call whenever you need the
filelist. That will avoid your timing issues, I think.
String [] getFilelist() { return uploadDir.list(); }
-Christopher
|---------+---------------------------->
| | "Johannes Becker"|
| | <[EMAIL PROTECTED]|
| | ail.com> |
| | |
| | 10/28/2003 11:30 |
| | AM |
| | Please respond to|
| | users |
| | |
|---------+---------------------------->
>--------------------------------------------------------------------------------------------------------------|
|
|
| To: [EMAIL PROTECTED]
|
| cc:
|
| Subject: Re: Weird logicsheet problem
|
>--------------------------------------------------------------------------------------------------------------|
Hi.
this piece posted works almost fine:
<xsl:template match="xsp:page">
<xsp:page>
<xsl:apply-templates select="@*"/>
<xsp:structure>
<xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
<xsp:include>org.apache.avalon.framework.context.ContextException</xsp:include>
</xsp:structure>
<xsp:logic>
public void contextualize(Context
context) throws ContextException (
uploadDir = (File)
context.get(Contstants.CONTEXT_UPLOAD_DIR);
}
String[] filelist =
uploadDir.list();
</xsp:logic>
<xsl:apply-templates select="node()"/>
</xsp:page>
</xsl:template>
The only problem: It always gives a nullpointer-exception, because the
"uploadDir.list()" is empty (for some stupid reason).
In my xsp's this code works fine. It gets all the names of the
files(+directories) of the upload-directory I specified in the web.xml file
(and in my case this directory isn't empty).
Thanks
Jonny
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]