[Seasar-user:10968] Re: uploadfile

=?GB2312?B?wO7A1g==?= [E-MAIL ADDRESS DELETED]
2007年 10月 12日 (金) 10:42:47 JST


Thanks a lot for your attention.

teeda1.0.11
seasar2 s2-dao-1.0.39 s2-extension-2.4.17
tomahawk 1.1.1
commons-fileupload 1.0
-----------------------------------------------------
web.xml---------------------------------------
<?xml version="1.0"?>

<!--
 * Copyright 2004-2006 the Seasar Foundation and the Others.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
-->

<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <!--
    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>
            /WEB-INF/faces-config.xml
        </param-value>
        <description>
            Comma separated list of URIs of (additional) faces config files.
            (e.g. /WEB-INF/my-config.xml)
            See JSF 1.0 PRD2, 10.3.2
        </description>
    </context-param>
    -->

    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
        <description>
            State saving method: "client" or "server" (= default)
            See JSF Specification 2.5.2
        </description>
    </context-param>

    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.html</param-value>
    </context-param>

    <filter>
        <filter-name>encodingfilter</filter-name>
        <filter-class>org.seasar.extension.filter.EncodingFilter
</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>

    <filter>
        <filter-name>s2filter</filter-name>
        <filter-class>
org.seasar.framework.container.filter.S2ContainerFilter</filter-class>
    </filter>

    <filter>
        <filter-name>hotdeployfilter</filter-name>
        <filter-class>
org.seasar.framework.container.hotdeploy.HotdeployFilter</filter-class>
    </filter>

    <filter>
        <filter-name>extensionfilter</filter-name>
        <filter-class>org.seasar.teeda.extension.filter.ExtensionFilter
</filter-class>
    </filter>

 <!--
    <filter>
        <filter-name>loginfilter</filter-name>
        <filter-class>test.web.start.LoginFilter</filter-class>
    </filter>
 -->

 <!--
    <filter>
        <filter-name>requestDumpFilter</filter-name>
        <filter-class>org.seasar.teeda.core.filter.RequestDumpFilter
</filter-class>
    </filter>
 -->

    <filter-mapping>
        <filter-name>encodingfilter</filter-name>
        <url-pattern>*.html</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>s2filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>hotdeployfilter</filter-name>
        <url-pattern>/*</url-pattern>
        <!--
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
         -->
    </filter-mapping>

 <!--
    <filter-mapping>
        <filter-name>requestDumpFilter</filter-name>
        <url-pattern>/view/*</url-pattern>
    </filter-mapping>
 -->

    <filter-mapping>
        <filter-name>extensionfilter</filter-name>
        <url-pattern>/teedaExtension/*</url-pattern>
    </filter-mapping>

<!--   -->
    <filter>
        <filter-name>dcwAuthfilter</filter-name>
        <filter-class>jp.wess.logic.auth.DcwAuthFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>dcwAuthfilter</filter-name>
        <url-pattern>/view/cmn/frameset.html</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>dcwAuthfilter</filter-name>
        <url-pattern>/view/cmn/header.html</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>dcwAuthfilter</filter-name>
        <url-pattern>/view/cmn/menu.html</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>dcwAuthfilter</filter-name>
        <url-pattern>/view/cmn/procOver.html</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>dcwAuthfilter</filter-name>
        <url-pattern>/view/cu/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>dcwAuthfilter</filter-name>
        <url-pattern>/view/m/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>dcwAuthfilter</filter-name>
        <url-pattern>/view/op/*</url-pattern>
    </filter-mapping>


<!-- lile -->
<filter>
        <filter-name>extensionsFilter</filter-name>
        <filter-class>
org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
        <init-param>
            <param-name>uploadMaxFileSize</param-name>
            <param-value>100m</param-value>
            <description>Set the size limit for uploaded files.
                Format: 10 - 10 bytes
                        10k - 10 KB
                        10m - 10 MB
                        1g - 1 GB
            </description>
        </init-param>
        <init-param>
            <param-name>uploadThresholdSize</param-name>
            <param-value>100m</param-value>
            <description>Set the threshold size - files
                    below this limit are stored in memory, files above
                    this limit are stored on disk.

                Format: 10 - 10 bytes
                        10k - 10 KB
                        10m - 10 MB
                        1g - 1 GB
            </description>
        </init-param>
            <init-param>
            <param-name>uploadRepositoryPath</param-name>
            <param-value>/work</param-value>
            <description>Set the path where the intermediary files will be
stored.
            </description>
        </init-param>
    </filter>
    <!-- lile -->



 <!--
    <listener>
        <listener-class>org.seasar.teeda.core.webapp.TeedaConfigureListener
</listener-class>
    </listener>
 -->

 <!-- Teeda initialize servlet -->
    <servlet>
        <servlet-name>teedaServlet</servlet-name>
        <servlet-class>org.seasar.teeda.core.webapp.TeedaServlet
</servlet-class>
<!--    If you want to run teeda-html-example as Portlet, replace
TeedaServlet with
        TeedaPortletExtendedServlet and add S2Portlet and Portlet Filter.
        S2Portlet: http://s2portlet.sandbox.seasar.org/
        Portlet Filter: http://portals.apache.org/bridges/
        <servlet-class>
org.seasar.teeda.core.webapp.TeedaPortletExtendedServlet</servlet-class>
-->
        <init-param>
         <param-name>configPath</param-name>
         <param-value>app.dicon</param-value>
     </init-param>
     <init-param>
         <param-name>debug</param-name>
         <param-value>true</param-value>
     </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- facesServlet -->
    <servlet>
        <servlet-name>facesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>ajaxServlet</servlet-name>
        <servlet-class>org.seasar.teeda.ajax.AjaxServlet</servlet-class>
        <load-on-startup>3</load-on-startup>
    </servlet>


    <servlet-mapping>
        <servlet-name>facesServlet</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>teedaServlet</servlet-name>
        <url-pattern>/teedaServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>ajaxServlet</servlet-name>
        <url-pattern>*.ajax</url-pattern>
    </servlet-mapping>


    <session-config>
        <session-timeout>100</session-timeout>
    </session-config>

    <welcome-file-list>
        <welcome-file>view/main.html</welcome-file>
    </welcome-file-list>

</web-app>


2007/10/12, Shinpei Ohtani <[E-MAIL ADDRESS DELETED]>:
>
> 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 mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>
>
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
URL: http://ml.seasar.org/archives/seasar-user/attachments/20071012/cd7abc72/attachment.html 


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