Win a copy of Murach's Python Programming this week in the Jython/Python forum!
    Bookmark Topic Watch Topic
  • New Topic

Can't get details on form file...  RSS feed

 
Joe Tseng
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Report post to moderator
I want to be able to get the name of the file I've selected for upload. When my code runs <formfile>.getFileName(), I get a NullPointerException message. Here's the test code in question:

JPF/controller:

protected Forward submit(SubmitForm form)
{
fileName = form.getFile1().getFileName();
return new Forward("success");
}

public static class SubmitForm extends FormData
{
private FormFile file1;

public void setFile1(FormFile file1)
{
this.file1 = file1;
}

public FormFile getFile1()
{
return this.file1;
}
}

JSP:

<netui:fileUpload dataSource="{actionForm.file1}"/>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. Continue any discussion in the original post here.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!