[Seasar-user:10967] Re: uploadfile

Shinpei Ohtani [E-MAIL ADDRESS DELETED]
2007年 10月 12日 (金) 07:31:32 JST


Ok, please show me:
 -web.xml
 -version of Teeda, Seasar2, and Tomahawk and commons-fileupload

I am going to figure out as much as I can.
And, did you see teeda-html-example that I told you?
Any differences you see or not?


2007/10/11, 川赤 <[E-MAIL ADDRESS DELETED]>:
> I'am sorry but of course i have getter&setter methods in my page class.
> And i also has these namespace in my html file.
> It's my fault that i didn't peist these code .
>
> As i said , i don't want to show the inputFileUpload,thus i hide it.
> I want to use another button to achieve the upload function,
> so i wrote a js to call the inputFileUpload's click method , when i clicked
> another button.
>
> I wanna if these's something wrong with my web.xml?
> should i write anything else ?
>
> 2007/10/11, Shinpei Ohtani <[E-MAIL ADDRESS DELETED]>:
> >
> > Hey,
> >
> > Ok, I see there might be some problems.
> >
> > Is there setter/getter for "private UploadedFile applyFile"?
> > We must have it.
> >
> > And I also mention that your html has namespace something like below
> > to use FileUpload.So, make sure for that.
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> >
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > <html xmlns:x=" http://myfaces.apache.org/tomahawk"
> > xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
> >
> >
> > I don't get there is some javascript for the button, but
> > I think it does not need to.What is it for?
> >
> >
> > Before having more help from this ML,
> > please see upload example from teeda-html-example.
> > (
> http://teeda.seasar.org/download/2007-10-10/teeda-html-example-1.0.11-SP1.zip)
> > It might be helpful.
> >
> > Thanks, anyway.
> >
> >
> > 2007/10/11, 川赤 <[E-MAIL ADDRESS DELETED]>:
> > >
> ----------------------------------------page-----------------------------------------------------
> > > package jp.wess.web.entrcdApply;
> > >
> > > public class EntrcdObjectListPage extends BaseGridPage {
> > >     private UploadedFile applyFile;
> > >
> > >         public String doPaging() {
> > >             super.setLimit(2);
> > >             applyNoDto.setOffset(super.getNewOffset());
> > >             applyNoDto.setLimit (super.getLimit());
> > >             if ("apply".equals(flag)) {
> > >                 applyTargetInfoItems =
> > > getEntrcdTargetInfoDao().getTargetInfoList(applyNoDto);
> > >                 super.setCount (applyNoDto.getCount());
> > >             } else {
> > >                 reissueTargetInfoItems =
> > > getEntrcdReissueTargetInfoDao().getList(applyNoDto);
> > >                 super.setCount(applyNoDto.getCount ());
> > >             }
> > >             return null;
> > >         }
> > >
> > >         public String doApplyUpload() throws IOException {
> > >             String name = applyFile.getName();
> > >             long size = applyFile.getSize();
> > >             System.out.println(name);
> > >             System.out.println (size);
> > >             InputStream in = null;
> > >             OutputStream out = null;
> > >             String path = "D:\\aaa.txt";
> > >             in = applyFile.getInputStream();
> > >             out = new FileOutputStream(path);
> > >             int read = 0;
> > >             int byteLength = applyFile.getBytes().length;
> > >             byte[] buffer = new byte[byteLength];
> > >             while ((read = in.read(buffer)) != -1) {
> > >                 out.write(buffer, 0, read);
> > >             }
> > >             out.close();
> > >             in.close();
> > > //            long fileSize1 = applyFile.getSize();
> > >             try {
> > >                 applyFile.getBytes();
> > >              } catch (IOException e) {
> > >                 // TODO Auto-generated catch block
> > >                 e.printStackTrace();
> > >             }
> > >             return null;
> > >         }
> > > }
> > >
> ----------------------------------------html-----------------------------------------
> > > <form id="form">
> > > <x:inputFileUpload
> > >   id="applyFile" name="applyFile" style="display:none"
> > >   value="#{entrcdApply_entrcdObjectListPage.applyFile}"
> > > />
> > > <input type="submit" class="button large"  value="¥¢¥Ã¥×¥í©`¥É"
> > >    onclick="uploadfile('doApplyUpload','applyFile')"
> > > id="doApplyUpload"/>
> > >
> > >
> -------------------------------------------------JavaScript-----------------------------------
> > >
> > >
> > > function uploadfile(btna, btnb) {
> > >
> > > var buttona = document.getElementsByName(btna);
> > > var buttonb = document.getElementByName(btnb);
> > > buttonb.click();
> > > }
> > >
> > > 參貧。
> > > 2007/10/11, Shinpei Ohtani <[E-MAIL ADDRESS DELETED]>:
> > > > Hi,
> > > >
> > > > Let me see your page class and html.
> > > >
> > > > 2007/10/11, 川赤 < [E-MAIL ADDRESS DELETED]>:
> > > > > I want to upload file,but i don't want to display the inputtext and
> > > button
> > > > > as system designed ,so i hiddened it .
> > > > > I'd like to place a button to call the uploadfile button which is
> > > hidden.
> > > > >
> > > > > My code is like this:
> > > > >
> > > > > <x:inputFileUpload
> > > > >   id="applyFile"  style="display:none"
> name="applyFile"
> > > > >   value="#{Apply_ListPage.applyFile}"
> > > > > />
> > > > >  <input type="submit"  name="applyupload"
> > > value="¥¢¥Ã¥×¥í©`¥É"
> > > > >
> onclick="uploadfile('doApplyUpload','applyFile')"
> > > > > id="doApplyUpload"/>
> > > > >
> > > > >
> > > > > function uploadfile(btna, btnb) {
> > > > >
> > > > >  var buttona = document.getElementsByName(btna);
> > > > >  var buttonb = document.getElementsByName(btnb);
> > > > >  buttonb.click ();
> > > > > }
> > > > > It doesn't work. Why?
> > > > >
> > > > > Is there any other way to achieve my goal.
> > > > > _______________________________________________
> > > > > Seasar-user mailing list
> > > > > [E-MAIL ADDRESS DELETED]
> > > > > https://ml.seasar.org/mailman/listinfo/seasar-user
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > =============================
> > > > Shinpei Ohtani
> > > > [E-MAIL ADDRESS DELETED]
> > > > =============================
> > > >
> > > > _______________________________________________
> > > > Seasar-user mailing list
> > > > [E-MAIL ADDRESS DELETED]
> > > > https://ml.seasar.org/mailman/listinfo/seasar-user
> > > >
> > > >
> > >
> > >
> > > _______________________________________________
> > > Seasar-user mailing list
> > > [E-MAIL ADDRESS DELETED]
> > > https://ml.seasar.org/mailman/listinfo/seasar-user
> > >
> > >
> >
> >
> > --
> > =============================
> > Shinpei Ohtani
> > [E-MAIL ADDRESS DELETED]
> > =============================
> >
> > _______________________________________________
> > Seasar-user mailing list
> > [E-MAIL ADDRESS DELETED]
> > https://ml.seasar.org/mailman/listinfo/seasar-user
> >
> >
>
>
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>
>


-- 
=============================
Shinpei Ohtani
[E-MAIL ADDRESS DELETED]
=============================


Seasar-user メーリングリストの案内