<div>----------------------------------------page-----------------------------------------------------</div>
<div>package jp.wess.web.entrcdApply;</div>
<div> </div>
<div>public class EntrcdObjectListPage extends BaseGridPage {</div>
<div> private UploadedFile applyFile;</div>
<div> </div>
<div> public String doPaging() {<br> super.setLimit(2);<br> applyNoDto.setOffset(super.getNewOffset());<br> applyNoDto.setLimit(super.getLimit());<br> if ("apply".equals(flag)) {
<br> applyTargetInfoItems = getEntrcdTargetInfoDao().getTargetInfoList(applyNoDto);<br> super.setCount(applyNoDto.getCount());<br> } else {<br> reissueTargetInfoItems = getEntrcdReissueTargetInfoDao().getList(applyNoDto);
<br> super.setCount(applyNoDto.getCount());<br> }<br> return null;<br> }</div>
<div> </div>
<div> 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> }</div>
<div>}<br>----------------------------------------html-----------------------------------------<br><form id="form"></div>
<div><x:inputFileUpload <br> id="applyFile" name="applyFile" style="display:none" <br> value="#{entrcdApply_entrcdObjectListPage.applyFile}"<br>/></div>
<div><input type="submit" class="button large" value="¥¢¥Ã¥×¥í©`¥É"<br> onclick="uploadfile('doApplyUpload','applyFile')" id="doApplyUpload"/></div>
<div> </div>
<div>-------------------------------------------------JavaScript-----------------------------------</div>
<div>
<p>function uploadfile(btna, btnb) {</p>
<p>var buttona = document.getElementsByName(btna);<br>var buttonb = document.getElementByName(btnb);<br>buttonb.click();<br>}</p>
<p>ÒÔÉÏ¡£</p></div>
<div><span class="gmail_quote">2007/10/11, 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>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 and button<br>> as system designed ,so i hiddened it .<br>> I'd like to place a button to call the uploadfile button which is hidden.
<br>><br>> My code is like this:<br>><br>> <x:inputFileUpload<br>> id="applyFile" style="display:none" name="applyFile"<br>> value="#{Apply_ListPage.applyFile}"
<br>> /><br>> <input type="submit" name="applyupload" value="¥¢¥Ã¥×¥í©`¥É"<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>> <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>