搜尋此網誌

2015年10月2日 星期五

JSP&Servlet筆記

html設定編碼
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
</head>


<form>的enctype屬性

[預設值]
<form action="test" method="post" enctype="application/x-www-form-urlencoded">
    <input type="text" name="column1">
</form>

[上傳檔案]

<form action="test" method="post" enctype="multipart/form-data">
    <input type="file" name="filename" value=""/><br/>
    <input type="submit" value="upload" name="upload">
</form>


取得上傳檔案getPart()
Servlet需標註@MultipartConfig
part.write()寫入硬碟

沒有留言:

張貼留言