<div>Does anybody have samples of fileupload ?</div>
<div> </div>
<div>Can i get a copy?</div>
<div> </div>
<div>Best regards.</div>
<div><br><br> </div>
<div><span class="gmail_quote">2007/10/12, Shinpei Ohtani <<a href="mailto:shinpei.ohtani@gmail.com">shinpei.ohtani@gmail.com</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br><br>As I see, you can not write <filter> after <filter-mapping> for web.xml.<br>So, make sure writing <filter> before <filter-mapping>.
<br><br>Thanks,<br><br>2007/10/12, 李乐 <<a href="mailto:yourslee@gmail.com">yourslee@gmail.com</a>>:<br>> Thanks a lot for your attention.<br>><br>> teeda1.0.11<br>> seasar2 s2-dao-1.0.39 s2-extension-2.4.17
<br>> tomahawk 1.1.1<br>> commons-fileupload 1.0<br>> -----------------------------------------------------web.xml---------------------------------------<br>> <?xml version="1.0"?><br>><br>> <!--
<br>> * Copyright 2004-2006 the Seasar Foundation and the Others.<br>> *<br>> * Licensed under the Apache License, Version 2.0 (the "License");<br>> * you may not use this file except in compliance with the License.
<br>> * You may obtain a copy of the License at<br>> *<br>> * <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><br>> *<br>> * Unless required by applicable law or agreed to in writing, software
<br>> * distributed under the License is distributed on an "AS IS" BASIS,<br>> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,<br>> * either express or implied. See the License for the specific language
<br>> * governing permissions and limitations under the License.<br>> --><br>><br>> <!DOCTYPE web-app PUBLIC<br>> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"<br>> "
<a href="http://java.sun.com/dtd/web-app_2_3.dtd">http://java.sun.com/dtd/web-app_2_3.dtd</a>"><br>><br>> <web-app><br>><br>> <!--<br>> <context-param><br>> <param-name>
javax.faces.CONFIG_FILES</param-name><br>> <param-value><br>> /WEB-INF/faces-config.xml<br>> </param-value><br>> <description><br>> Comma separated list of URIs of (additional) faces config files.
<br>> (e.g. /WEB-INF/my-config.xml)<br>> See JSF 1.0 PRD2, 10.3.2<br>> </description><br>> </context-param><br>> --><br>><br>> <context-param>
<br>> <param-name>javax.faces.STATE_SAVING_METHOD</param-name><br>> <param-value>server</param-value><br>> <description><br>> State saving method: "client" or "server" (= default)
<br>> See JSF Specification 2.5.2<br>> </description><br>> </context-param><br>><br>> <context-param><br>> <param-name>javax.faces.DEFAULT_SUFFIX
</param-name><br>> <param-value>.html</param-value><br>> </context-param><br>><br>> <filter><br>> <filter-name>encodingfilter</filter-name><br>
><br>> <filter-class>org.seasar.extension.filter.EncodingFilter</filter-class><br>> <init-param><br>> <param-name>encoding</param-name><br>> <param-value>UTF-8</param-value>
<br>> </init-param><br>> </filter><br>><br>> <filter><br>> <filter-name>s2filter</filter-name><br>><br>> <filter-class>org.seasar.framework.container.filter.S2ContainerFilter
</filter-class><br>> </filter><br>><br>> <filter><br>> <filter-name>hotdeployfilter</filter-name><br>><br>> <filter-class>org.seasar.framework.container.hotdeploy.HotdeployFilter
</filter-class><br>> </filter><br>><br>> <filter><br>> <filter-name>extensionfilter</filter-name><br>><br>> <filter-class>org.seasar.teeda.extension.filter.ExtensionFilter
</filter-class><br>> </filter><br>><br>> <!--<br>> <filter><br>> <filter-name>loginfilter</filter-name><br>> <filter-class>test.web.start.LoginFilter
</filter-class><br>> </filter><br>> --><br>><br>> <!--<br>> <filter><br>> <filter-name>requestDumpFilter</filter-name><br>><br>> <filter-class>
org.seasar.teeda.core.filter.RequestDumpFilter</filter-class><br>> </filter><br>> --><br>><br>> <filter-mapping><br>> <filter-name>encodingfilter</filter-name>
<br>> <url-pattern>*.html</url-pattern><br>> </filter-mapping><br>><br>> <filter-mapping><br>> <filter-name>s2filter</filter-name><br>> <url-pattern>/*</url-pattern>
<br>> </filter-mapping><br>><br>> <filter-mapping><br>> <filter-name>hotdeployfilter</filter-name><br>> <url-pattern>/*</url-pattern><br>> <!--
<br>> <dispatcher>REQUEST</dispatcher><br>> <dispatcher>FORWARD</dispatcher><br>> --><br>> </filter-mapping><br>><br>> <!--<br>> <filter-mapping>
<br>> <filter-name>requestDumpFilter</filter-name><br>> <url-pattern>/view/*</url-pattern><br>> </filter-mapping><br>> --><br>><br>> <filter-mapping>
<br>> <filter-name>extensionfilter</filter-name><br>> <url-pattern>/teedaExtension/*</url-pattern><br>> </filter-mapping><br>><br>> <!-- --><br>> <filter>
<br>> <filter-name>dcwAuthfilter</filter-name><br>><br>> <filter-class>jp.wess.logic.auth.DcwAuthFilter</filter-class><br>> </filter><br>><br>> <filter-mapping>
<br>> <filter-name>dcwAuthfilter</filter-name><br>> <url-pattern>/view/cmn/frameset.html</url-pattern><br>> </filter-mapping><br>><br>> <filter-mapping>
<br>> <filter-name>dcwAuthfilter</filter-name><br>> <url-pattern>/view/cmn/header.html</url-pattern><br>> </filter-mapping><br>><br>> <filter-mapping>
<br>> <filter-name>dcwAuthfilter</filter-name><br>> <url-pattern>/view/cmn/menu.html</url-pattern><br>> </filter-mapping><br>><br>> <filter-mapping>
<br>> <filter-name>dcwAuthfilter</filter-name><br>> <url-pattern>/view/cmn/procOver.html</url-pattern><br>> </filter-mapping><br>><br>> <filter-mapping>
<br>> <filter-name>dcwAuthfilter</filter-name><br>> <url-pattern>/view/cu/*</url-pattern><br>> </filter-mapping><br>><br>> <filter-mapping><br>> <filter-name>dcwAuthfilter</filter-name>
<br>> <url-pattern>/view/m/*</url-pattern><br>> </filter-mapping><br>><br>> <filter-mapping><br>> <filter-name>dcwAuthfilter</filter-name><br>> <url-pattern>/view/op/*</url-pattern>
<br>> </filter-mapping><br>><br>><br>> <!-- lile --><br>> <filter><br>> <filter-name>extensionsFilter</filter-name><br>><br>> <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter
</filter-class><br>> <init-param><br>> <param-name>uploadMaxFileSize</param-name><br>> <param-value>100m</param-value><br>> <description>Set the size limit for uploaded files.
<br>> Format: 10 - 10 bytes<br>> 10k - 10 KB<br>> 10m - 10 MB<br>> 1g - 1 GB<br>> </description><br>
> </init-param><br>> <init-param><br>> <param-name>uploadThresholdSize</param-name><br>> <param-value>100m</param-value><br>> <description>Set the threshold size - files
<br>> below this limit are stored in memory, files above<br>> this limit are stored on disk.<br>><br>> Format: 10 - 10 bytes<br>> 10k - 10 KB
<br>> 10m - 10 MB<br>> 1g - 1 GB<br>> </description><br>> </init-param><br>> <init-param><br>> <param-name>uploadRepositoryPath</param-name>
<br>> <param-value>/work</param-value><br>> <description>Set the path where the intermediary files will be<br>> stored.<br>> </description><br>> </init-param>
<br>> </filter><br>> <!-- lile --><br>><br>><br>><br>> <!--<br>> <listener><br>><br>> <listener-class>org.seasar.teeda.core.webapp.TeedaConfigureListener<br>
> </listener-class><br>> </listener><br>> --><br>><br>> <!-- Teeda initialize servlet --><br>> <servlet><br>> <servlet-name>teedaServlet</servlet-name>
<br>><br>> <servlet-class>org.seasar.teeda.core.webapp.TeedaServlet</servlet-class><br>> <!-- If you want to run teeda-html-example as Portlet, replace<br>> TeedaServlet with<br>> TeedaPortletExtendedServlet and add S2Portlet and Portlet Filter.
<br>> S2Portlet: <a href="http://s2portlet.sandbox.seasar.org/">http://s2portlet.sandbox.seasar.org/</a><br>> Portlet Filter: <a href="http://portals.apache.org/bridges/">http://portals.apache.org/bridges/
</a><br>><br>> <servlet-class>org.seasar.teeda.core.webapp.TeedaPortletExtendedServlet<br>> </servlet-class><br>> --><br>> <init-param><br>> <param-name>configPath</param-name>
<br>> <param-value>app.dicon</param-value><br>> </init-param><br>> <init-param><br>> <param-name>debug</param-name><br>> <param-value>true</param-value>
<br>> </init-param><br>> <load-on-startup>1</load-on-startup><br>> </servlet><br>><br>> <!-- facesServlet --><br>> <servlet><br>> <servlet-name>facesServlet</servlet-name>
<br>> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class><br>> <load-on-startup>2</load-on-startup><br>> </servlet><br>><br>> <servlet>
<br>> <servlet-name>ajaxServlet</servlet-name><br>><br>> <servlet-class>org.seasar.teeda.ajax.AjaxServlet</servlet-class><br>> <load-on-startup>3</load-on-startup>
<br>> </servlet><br>><br>><br>> <servlet-mapping><br>> <servlet-name>facesServlet</servlet-name><br>> <url-pattern>*.html</url-pattern><br>> </servlet-mapping>
<br>><br>> <servlet-mapping><br>> <servlet-name>teedaServlet</servlet-name><br>> <url-pattern>/teedaServlet</url-pattern><br>> </servlet-mapping><br>
><br>> <servlet-mapping><br>> <servlet-name>ajaxServlet</servlet-name><br>> <url-pattern>*.ajax</url-pattern><br>> </servlet-mapping><br>><br>>
<br>> <session-config><br>> <session-timeout>100</session-timeout><br>> </session-config><br>><br>> <welcome-file-list><br>> <welcome-file>view/main.html</welcome-file>
<br>> </welcome-file-list><br>><br>> </web-app><br>><br>><br>><br>> 2007/10/12, Shinpei Ohtani <<a href="mailto:shinpei.ohtani@gmail.com">shinpei.ohtani@gmail.com</a>>:<br>> > Ok, please show me:
<br>> > -web.xml<br>> > -version of Teeda, Seasar2, and Tomahawk and commons-fileupload<br>> ><br>> > I am going to figure out as much as I can.<br>> > And, did you see teeda-html-example that I told you?
<br>> > Any differences you see or not?<br>> ><br>> ><br>> > 2007/10/11, 李乐 <<a href="mailto:yourslee@gmail.com">yourslee@gmail.com</a> >:<br>> > > I'am sorry but of course i have getter&setter methods in my page class.
<br>> > > And i also has these namespace in my html file.<br>> > > It's my fault that i didn't peist these code .<br>> > ><br>> > > As i said , i don't want to show the inputFileUpload,thus i hide it.
<br>> > > I want to use another button to achieve the upload function,<br>> > > so i wrote a js to call the inputFileUpload's click method , when i<br>> clicked<br>> > > another button.<br>
> > ><br>> > > I wanna if these's something wrong with my web.xml?<br>> > > should i write anything else ?<br>> > ><br>> > > 2007/10/11, Shinpei Ohtani < <a href="mailto:shinpei.ohtani@gmail.com">
shinpei.ohtani@gmail.com</a>>:<br>> > > ><br>> > > > Hey,<br>> > > ><br>> > > > Ok, I see there might be some problems.<br>> > > ><br>> > > > Is there setter/getter for "private UploadedFile applyFile"?
<br>> > > > We must have it.<br>> > > ><br>> > > > And I also mention that your html has namespace something like below<br>> > > > to use FileUpload.So, make sure for that.<br>
> > > ><br>> > > > <?xml version=" 1.0" encoding="UTF-8"?><br>> > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br>> > > >
<br>> > > "<br>> <a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"><br>> > > > <html xmlns:x=" <a href="http://myfaces.apache.org/tomahawk">
http://myfaces.apache.org/tomahawk</a>"<br>> > > > xmlns=" <a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>" xml:lang="ja" lang="ja"><br>> > > >
<br>> > > ><br>> > > > I don't get there is some javascript for the button, but<br>> > > > I think it does not need to.What is it for?<br>> > > ><br>> > > ><br>
> > > > Before having more help from this ML,<br>> > > > please see upload example from teeda-html-example.<br>> > > > (<br>> > ><br>> <a href="http://teeda.seasar.org/download/2007-10-10/teeda-html-example-1.0.11-SP1.zip">
http://teeda.seasar.org/download/2007-10-10/teeda-html-example-1.0.11-SP1.zip</a>)<br>> > > > It might be helpful.<br>> > > ><br>> > > > Thanks, anyway.<br>> > > ><br>> > > >
<br>> > > > 2007/10/11, 李乐 <<a href="mailto:yourslee@gmail.com">yourslee@gmail.com</a>>:<br>> > > > ><br>> > ><br>> ----------------------------------------page-----------------------------------------------------
<br>> > > > > package jp.wess.web.entrcdApply;<br>> > > > ><br>> > > > > public class EntrcdObjectListPage extends BaseGridPage {<br>> > > > > private UploadedFile applyFile;
<br>> > > > ><br>> > > > > public String doPaging() {<br>> > > > > super.setLimit(2);<br>> > > > > applyNoDto.setOffset(super.getNewOffset
());<br>> > > > > applyNoDto.setLimit (super.getLimit());<br>> > > > > if ("apply".equals(flag)) {<br>> > > > > applyTargetInfoItems =
<br>> > > > ><br>> getEntrcdTargetInfoDao().getTargetInfoList(applyNoDto);<br>> > > > > super.setCount (applyNoDto.getCount());<br>> > > > > } else {
<br>> > > > > reissueTargetInfoItems =<br>> > > > ><br>> getEntrcdReissueTargetInfoDao().getList(applyNoDto);<br>> > > > > super.setCount(applyNoDto.getCount
());<br>> > > > > }<br>> > > > > return null;<br>> > > > > }<br>> > > > ><br>> > > > > public String doApplyUpload() throws IOException {
<br>> > > > > String name = applyFile.getName ();<br>> > > > > long size = applyFile.getSize();<br>> > > > > System.out.println(name);<br>> > > > >
System.out.println (size);<br>> > > > > InputStream in = null;<br>> > > > > OutputStream out = null;<br>> > > > > String path = "D:\\aaa.txt";
<br>> > > > > in = applyFile.getInputStream();<br>> > > > > out = new FileOutputStream(path);<br>> > > > > int read = 0;<br>> > > > > int byteLength =
applyFile.getBytes().length;<br>> > > > > byte[] buffer = new byte[byteLength];<br>> > > > > while ((read = in.read(buffer)) != -1) {<br>> > > > >
out.write(buffer, 0, read);<br>> > > > > }<br>> > > > > out.close();<br>> > > > > in.close();<br>> > > > > // long fileSize1 =
applyFile.getSize();<br>> > > > > try {<br>> > > > > applyFile.getBytes();<br>> > > > > } catch (IOException e) {<br>> > > > > // TODO Auto-generated catch block
<br>> > > > > e.printStackTrace();<br>> > > > > }<br>> > > > > return null;<br>> > > > > }<br>> > > > > }
<br>> > > > ><br>> > ><br>> ----------------------------------------html-----------------------------------------<br>> > > > > <form id="form"><br>> > > > > <x:inputFileUpload
<br>> > > > > id="applyFile" name="applyFile" style="display:none"<br>> > > > ><br>> value="#{entrcdApply_entrcdObjectListPage.applyFile}"<br>> > > > > />
<br>> > > > > <input type="submit" class="button large" value="アップロード"<br>> > > > ><br>> onclick="uploadfile('doApplyUpload','applyFile')"
<br>> > > > > id="doApplyUpload"/><br>> > > > ><br>> > > > ><br>> > ><br>> -------------------------------------------------JavaScript-----------------------------------
<br>> > > > ><br>> > > > ><br>> > > > > function uploadfile(btna, btnb) {<br>> > > > ><br>> > > > > var buttona = document.getElementsByName(btna);
<br>> > > > > var buttonb = document.getElementByName(btnb);<br>> > > > > buttonb.click ();<br>> > > > > }<br>> > > > ><br>> > > > > 以上。<br>> > > > > 2007/10/11, Shinpei Ohtani <
<a href="mailto:shinpei.ohtani@gmail.com">shinpei.ohtani@gmail.com</a>>:<br>> > > > > > Hi,<br>> > > > > ><br>> > > > > > Let me see your page class and html.<br>> > > > > >
<br>> > > > > > 2007/10/11, 李乐 < <a href="mailto:yourslee@gmail.com">yourslee@gmail.com</a>>:<br>> > > > > > > I want to upload file,but i don't want to display the inputtext
<br>> and<br>> > > > > button<br>> > > > > > > as system designed ,so i hiddened it .<br>> > > > > > > I'd like to place a button to call the uploadfile button which
<br>> is<br>> > > > > hidden.<br>> > > > > > ><br>> > > > > > > My code is like this:<br>> > > > > > ><br>> > > > > > > <x:inputFileUpload
<br>> > > > > > > id="applyFile" style="display:none"<br>> > > name="applyFile"<br>> > > > > > > value="#{Apply_ListPage.applyFile}"
<br>> > > > > > > /><br>> > > > > > > <input type="submit" name="applyupload"<br>> > > > > value="アップロード"<br>> > > > > > >
<br>> > > onclick="uploadfile('doApplyUpload','applyFile')"<br>> > > > > > > id="doApplyUpload"/><br>> > > > > > ><br>> > > > > > >
<br>> > > > > > > function uploadfile(btna, btnb) {<br>> > > > > > ><br>> > > > > > > var buttona = document.getElementsByName(btna);<br>> > > > > > > var buttonb =
document.getElementsByName (btnb);<br>> > > > > > > buttonb.click ();<br>> > > > > > > }<br>> > > > > > > It doesn't work. Why?<br>> > > > > > >
<br>> > > > > > > Is there any other way to achieve my goal.<br>> > > > > > > _______________________________________________<br>> > > > > > > Seasar-user mailing list
<br>> > > > > > > <a href="mailto:Seasar-user@ml.seasar.org">Seasar-user@ml.seasar.org</a><br>> > > > > > ><br>> <a href="https://ml.seasar.org/mailman/listinfo/seasar-user">https://ml.seasar.org/mailman/listinfo/seasar-user
</a><br>> > > > > > ><br>> > > > > > ><br>> > > > > ><br>> > > > > ><br>> > > > > > --<br>> > > > > > =============================
<br>> > > > > > Shinpei Ohtani<br>> > > > > > <a href="mailto:shinpei.ohtani@gmail.com">shinpei.ohtani@gmail.com</a><br>> > > > > > =============================<br>> > > > > >
<br>> > > > > > _______________________________________________<br>> > > > > > Seasar-user mailing list<br>> > > > > > <a href="mailto:Seasar-user@ml.seasar.org">Seasar-user@ml.seasar.org
</a><br>> > > > > ><br>> <a href="https://ml.seasar.org/mailman/listinfo/seasar-user">https://ml.seasar.org/mailman/listinfo/seasar-user</a><br>> > > > > ><br>> > > > > >
<br>> > > > ><br>> > > > ><br>> > > > > _______________________________________________<br>> > > > > Seasar-user mailing list<br>> > > > > <a href="mailto:Seasar-user@ml.seasar.org">
Seasar-user@ml.seasar.org</a><br>> > > > > <a href="https://ml.seasar.org/mailman/listinfo/seasar-user">https://ml.seasar.org/mailman/listinfo/seasar-user</a><br>> > > > ><br>> > > > >
<br>> > > ><br>> > > ><br>> > > > --<br>> > > > =============================<br>> > > > Shinpei Ohtani<br>> > > > <a href="mailto:shinpei.ohtani@gmail.com">
shinpei.ohtani@gmail.com</a><br>> > > > =============================<br>> > > ><br>> > > > _______________________________________________<br>> > > > Seasar-user mailing list
<br>> > > > <a href="mailto:Seasar-user@ml.seasar.org">Seasar-user@ml.seasar.org</a><br>> > > > <a href="https://ml.seasar.org/mailman/listinfo/seasar-user">https://ml.seasar.org/mailman/listinfo/seasar-user
</a><br>> > > ><br>> > > ><br>> > ><br>> > ><br>> > > _______________________________________________<br>> > > Seasar-user mailing list<br>> > > <a href="mailto:Seasar-user@ml.seasar.org">
Seasar-user@ml.seasar.org</a><br>> > > <a href="https://ml.seasar.org/mailman/listinfo/seasar-user">https://ml.seasar.org/mailman/listinfo/seasar-user</a><br>> > ><br>> > ><br>> ><br>> >
<br>> > --<br>> > =============================<br>> > Shinpei Ohtani<br>> > <a href="mailto:shinpei.ohtani@gmail.com">shinpei.ohtani@gmail.com</a><br>> > =============================<br>> >
<br>> > _______________________________________________<br>> > Seasar-user mailing list<br>> > <a href="mailto:Seasar-user@ml.seasar.org">Seasar-user@ml.seasar.org</a><br>> > <a href="https://ml.seasar.org/mailman/listinfo/seasar-user">
https://ml.seasar.org/mailman/listinfo/seasar-user</a><br>> ><br>> ><br>><br>><br>> _______________________________________________<br>> Seasar-user mailing list<br>> <a href="mailto:Seasar-user@ml.seasar.org">
Seasar-user@ml.seasar.org</a><br>> <a href="https://ml.seasar.org/mailman/listinfo/seasar-user">https://ml.seasar.org/mailman/listinfo/seasar-user</a><br>><br>><br><br><br>--<br>=============================<br>Shinpei Ohtani
<br><a href="mailto:shinpei.ohtani@gmail.com">shinpei.ohtani@gmail.com</a><br>=============================<br><br>_______________________________________________<br>Seasar-user mailing list<br><a href="mailto:Seasar-user@ml.seasar.org">
Seasar-user@ml.seasar.org</a><br><a href="https://ml.seasar.org/mailman/listinfo/seasar-user">https://ml.seasar.org/mailman/listinfo/seasar-user</a><br><br></blockquote></div><br>