I've tested the example code on the page. It works with the exception
of file.isTruncated(), which has been deprecated, I presume.
So the rest of the code, ie the code you post below, does work.
It must be a configuration issue. Are you running this example page
in isolation, or is it part of a larger project? Are you running
from inside Eclipse? If not, how is Tomcat started?
Cheers,
Nick.
Nazmul Bhuiyan wrote:
.page:
<page-specification class="com.fujitsu.efi.web.pages.test.UploadPage">
</page-specification>
The .page file was missed spelled but after correcting the file name I'm
getting the following error:
Could not load class UploadPage from WebappClassLoader delegate: false
repositories: /WEB-INF/classes/ ----------> Parent Classloader:
[EMAIL PROTECTED] : UploadPage
But com.fujitsu.efi.web.pages.test.UploadPage class exists in
WEB-INF/classes directory.
Thanks
Naz
Nick Westgate wrote:
What about your .page file?
Cheers,
Nick.
Nazmul Bhuiyan wrote:
If you click on the link I've provided you will see the code. I've copied
the
code from there. This is from my Upload.html and formSubmit is as below:
private IUploadFile file;
private File serverFile;
public IUploadFile getFile() { return file; }
public void setFile(IUploadFile value) {
file = value;
}
public void formSubmit(IRequestCycle cycle) {
InputStream fis = file.getStream();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(new File(file.getFileName()));
byte[] buffer = new byte[1024];
while (true) {
int length = fis.read(buffer);
if (length < 0) {
break;
}
fos.write(buffer, 0, length);
}
fis.close();
fos.close();
serverFile = new File(file.getFileName());
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (fis != null) {
try { fis.close(); } catch (IOException ioe) {}
}
if (fos != null) {
try { fos.close(); } catch (IOException ioe) {}
}
}
}
Nick Westgate wrote:
Ok. Is this in a page or a component?
And your Java code? Do you have a formSubmit listener?
Cheers,
Nick.
Nazmul Bhuiyan wrote:
I've copied the code from
http://tapestry.apache.org/tapestry3/doc/ComponentReference/Upload.html
<form jwcid="@Form" listener="ognl:listeners.formSubmit">
<table bgcolor="#c0c0c0" cellpadding="4">
<tr>
<td colspan="2">File: <input jwcid="@Upload"
file="ognl:file"
type="file"></input></td>
</tr>
<tr>
<td colspan="2"><input type="submit"
value="Upload"></input></td>
</tr>
Thanks
Naz
Nick Westgate wrote:
Please post the (relevant parts of) the code.
Cheers,
Nick.
Nazmul Bhuiyan wrote:
I'm getting an error when trying the Upload component example in
http://tapestry.apache.org/tapestry3/doc/ComponentReference/Upload.html.
Unable to resolve expression 'listeners.formSubmit' for
[EMAIL PROTECTED]
binding: ExpressionBinding[UploadPage listeners.formSubmit
cachedValue=null]
I've modified the listener.formSubmit to listeners.formSubmit
according
to
Nick and still getting the error.
Nick's answer for same issue in this forum:
http://www.nabble.com/Form-upload-and-download-tf2236396.html#a6201542
Is there anything missed?
Thanks
Naz
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]